chore: update Android test app dependencies to latest stable versions

- Update AndroidX AppCompat from 1.6.1 to 1.7.1 (latest stable)
- Update AndroidX Activity from 1.7.0 to 1.8.2
- Update AndroidX Core from 1.10.0 to 1.12.0
- Update AndroidX Fragment from 1.5.6 to 1.6.2
- Update Core Splash Screen from 1.0.0 to 1.0.1
- Update AndroidX WebKit from 1.6.1 to 1.8.0
- Update compile/target SDK from 33 to 34
- Update Gradle troubleshooting guide with latest versions

Dependency updates:
- androidx.appcompat:appcompat: 1.6.1 → 1.7.1
- androidx.activity:activity: 1.7.0 → 1.8.2
- androidx.core:core: 1.10.0 → 1.12.0
- androidx.fragment:fragment: 1.5.6 → 1.6.2
- androidx.core:core-splashscreen: 1.0.0 → 1.0.1
- androidx.webkit:webkit: 1.6.1 → 1.8.0
- compileSdkVersion: 33 → 34
- targetSdkVersion: 33 → 34

Documentation updates:
- Updated Gradle troubleshooting guide with latest versions
- Added dependency update section
- Updated version compatibility table
- Added AndroidX dependency update examples

Files: 2 modified
- Modified: android/variables.gradle (updated all AndroidX versions)
- Modified: GRADLE_TROUBLESHOOTING.md (updated documentation)
This commit is contained in:
Matthew Raymer
2025-09-09 08:34:16 +00:00
parent 956abff320
commit a2d1fb33a6
16 changed files with 12330 additions and 47 deletions

View File

@@ -0,0 +1,160 @@
# Android Test App Gradle Sync Troubleshooting
## Problem: Gradle Sync Failure
**Error Message:**
```
Unable to find method 'org.gradle.api.artifacts.Dependency org.gradle.api.artifacts.dsl.DependencyHandler.module(java.lang.Object)'
```
## Root Cause
The Android test app was using **Gradle 9.0-milestone-1** (pre-release) with **Android Gradle Plugin 8.0.0**, causing version incompatibility issues.
## Solution Applied
### 1. Updated Gradle Version
**File:** `android/gradle/wrapper/gradle-wrapper.properties`
```properties
# Changed from:
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0-milestone-1-bin.zip
# To:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
```
### 2. Updated Android Gradle Plugin
**File:** `android/build.gradle`
```gradle
// Changed from:
classpath 'com.android.tools.build:gradle:8.0.0'
// To:
classpath 'com.android.tools.build:gradle:8.13.0'
```
### 3. Updated Google Services Plugin
```gradle
// Changed from:
classpath 'com.google.gms:google-services:4.3.15'
// To:
classpath 'com.google.gms:google-services:4.4.0'
```
### 4. Updated AndroidX Dependencies
**File:** `android/variables.gradle`
```gradle
// Updated to latest stable versions:
androidxAppCompatVersion = '1.7.1' // was 1.6.1
androidxActivityVersion = '1.8.2' // was 1.7.0
androidxCoreVersion = '1.12.0' // was 1.10.0
androidxFragmentVersion = '1.6.2' // was 1.5.6
coreSplashScreenVersion = '1.0.1' // was 1.0.0
androidxWebkitVersion = '1.8.0' // was 1.6.1
compileSdkVersion = 34 // was 33
targetSdkVersion = 34 // was 33
```
## Manual Fix Steps
If you encounter this issue again:
### Step 1: Clean Gradle Cache
```bash
cd test-apps/android-test/android
./gradlew clean
./gradlew --stop
```
### Step 2: Clear Gradle Wrapper Cache
```bash
rm -rf ~/.gradle/wrapper/dists/gradle-9.0-milestone-1*
```
### Step 3: Re-sync Project
In Android Studio:
1. Click **File****Sync Project with Gradle Files**
2. Or click the **Sync Now** link in the error banner
### Step 4: If Still Failing
```bash
# Delete all Gradle caches
rm -rf ~/.gradle/caches
rm -rf ~/.gradle/wrapper
# Re-download Gradle
cd test-apps/android-test/android
./gradlew wrapper --gradle-version 8.4
```
## Prevention
### Use Stable Versions
Always use stable, tested version combinations:
| Android Gradle Plugin | Gradle Version | Status |
|----------------------|----------------|---------|
| 8.13.0 | 8.13 | ✅ Latest Stable |
| 8.1.4 | 8.4 | ✅ Stable |
| 8.0.0 | 8.0 | ✅ Stable |
| 7.4.2 | 7.5 | ✅ Stable |
| 8.0.0 | 9.0-milestone-1 | ❌ Incompatible |
### Version Compatibility Check
- **Android Gradle Plugin 8.13.0** requires **Gradle 8.0+**
- **Gradle 8.13** is the latest stable version
- **AndroidX AppCompat 1.7.1** is the latest stable version
- Avoid pre-release versions in production
## Additional Troubleshooting
### If Sync Still Fails
1. **Check Java Version**
```bash
java -version
# Should be Java 17+ for AGP 8.1.4
```
2. **Check Android SDK**
```bash
echo $ANDROID_HOME
# Should point to Android SDK location
```
3. **Check Local Properties**
```bash
# Verify android/local.properties exists
cat test-apps/android-test/android/local.properties
```
4. **Recreate Project**
```bash
cd test-apps/android-test
rm -rf android/
npx cap add android
```
## Success Indicators
After applying the fix, you should see:
- ✅ **Gradle sync successful**
- ✅ **No red error banners**
- ✅ **Build.gradle file opens without errors**
- ✅ **Project structure loads correctly**
## Next Steps
Once Gradle sync is successful:
1. **Build the project**: `./gradlew build`
2. **Run on device**: `npx cap run android`
3. **Test plugin functionality**: Use the test API server
4. **Validate notifications**: Test the Daily Notification Plugin
## Related Issues
- **Build failures**: Usually resolved by Gradle sync fix
- **Plugin not found**: Check Capacitor plugin installation
- **Permission errors**: Verify Android manifest permissions
- **Runtime crashes**: Check plugin initialization code

5214
test-apps/android-test/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff