Files
daily-notification-plugin/android/BUILDING.md
Matthew Raymer d9bdeb6d02 refactor(android)!: restructure to standard Capacitor plugin layout
Restructure Android project from nested module layout to standard
Capacitor plugin structure following community conventions.

Structure Changes:
- Move plugin code from android/plugin/ to android/src/main/java/
- Move test app from android/app/ to test-apps/android-test-app/app/
- Remove nested android/plugin module structure
- Remove nested android/app test app structure

Build Infrastructure:
- Add Gradle wrapper files (gradlew, gradlew.bat, gradle/wrapper/)
- Transform android/build.gradle from root project to library module
- Update android/settings.gradle for standalone plugin builds
- Add android/gradle.properties with AndroidX configuration
- Add android/consumer-rules.pro for ProGuard rules

Configuration Updates:
- Add prepare script to package.json for automatic builds on npm install
- Update package.json version to 1.0.1
- Update android/build.gradle to properly resolve Capacitor dependencies
- Update test-apps/android-test-app/settings.gradle with correct paths
- Remove android/variables.gradle (hardcode values in build.gradle)

Documentation:
- Update BUILDING.md with new structure and build process
- Update INTEGRATION_GUIDE.md to reflect standard structure
- Update README.md to remove path fix warnings
- Add test-apps/BUILD_PROCESS.md documenting test app build flows

Test App Configuration:
- Fix android-test-app to correctly reference plugin and Capacitor
- Remove capacitor-cordova-android-plugins dependency (not needed)
- Update capacitor.settings.gradle path verification in fix script

BREAKING CHANGE: Plugin now uses standard Capacitor Android structure.
Consuming apps must update their capacitor.settings.gradle to reference
android/ instead of android/plugin/. This is automatically handled by
Capacitor CLI for apps using standard plugin installation.
2025-11-05 08:08:37 +00:00

70 lines
1.9 KiB
Markdown

# Building the Daily Notification Plugin
## Important: Standalone Build Limitations
**Capacitor plugins cannot be built standalone** because Capacitor dependencies are npm packages, not Maven artifacts.
### ✅ Correct Way to Build
Build the plugin **within a Capacitor app** that uses it:
```bash
# In a consuming Capacitor app (e.g., test-apps/android-test-app or your app)
cd /path/to/capacitor-app/android
./gradlew assembleDebug
# Or use Capacitor CLI
npx cap sync android
npx cap run android
```
### ❌ What Doesn't Work
```bash
# This will fail - Capacitor dependencies aren't in Maven
cd android
./gradlew assembleDebug
```
### Why This Happens
1. **Capacitor dependencies are npm packages**, not Maven artifacts
2. **Capacitor plugins are meant to be consumed**, not built standalone
3. **The consuming app provides Capacitor** as a project dependency
4. **When you run `npx cap sync`**, Capacitor sets up the correct dependency structure
### For Development & Testing
Use the test app at `test-apps/android-test-app/`:
```bash
cd test-apps/android-test-app
npm install
npx cap sync android
cd android
./gradlew assembleDebug
```
The plugin will be built as part of the test app's build process.
### Gradle Wrapper Purpose
The gradle wrapper in `android/` is provided for:
-**Syntax checking** - Verify build.gradle syntax
-**Android Studio** - Open the plugin directory in Android Studio for editing
-**Documentation** - Show available tasks and structure
-**Not for standalone builds** - Requires a consuming app context
### Verifying Build Configuration
You can verify the build configuration is correct:
```bash
cd android
./gradlew tasks # Lists available tasks (may show dependency errors, that's OK)
./gradlew clean # Cleans build directory
```
The dependency errors are expected - they confirm the plugin needs a consuming app context.