Skip to content

Commit af09dc9

Browse files
authored
Merge pull request #608 from AppsFlyerSDK/dev/demo-app-gradle-fix
Downgrade gradle + doc about fix.
2 parents b12a6b7 + 009f27b commit af09dc9

File tree

5 files changed

+48
-5
lines changed

5 files changed

+48
-5
lines changed

Docs/RN_Installation.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,45 @@ So `getPackages()` should look like:
137137
}
138138
```
139139

140+
## Android Build Error Due to AGP Version
141+
142+
If you encounter the following error while building your project:
143+
```
144+
Execution failed for task ':app:mergeExtDexDebug'.
145+
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
146+
> Failed to transform af-android-sdk-6.16.0.aar (com.appsflyer:af-android-sdk:6.16.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
147+
> Execution failed for DexingWithClasspathTransform: /Users/amit.levy/.gradle/caches/transforms-3/fb46dcab411d99e4e97f01029413cab1/transformed/jetified-af-android-sdk-6.16.0-runtime.jar.
148+
> Error while dexing.
149+
```
150+
151+
This error occurs if you are using Android Gradle Plugin (AGP) below 8.2.0 due to a known bug in R8.
152+
Google has already resolved this issue
153+
[see Google Issue Tracker](https://issuetracker.google.com/issues/290412574?pli=1).
154+
155+
156+
### Solutions
157+
158+
To fix this issue, you have two options:
159+
1. Upgrade AGP to 8.2.0+ (Recommended):
160+
<br/>Updating AGP to 8.2.0 or later ensures compatibility with the latest R8 version.<br/>Sync and rebuild your project
161+
162+
2. Manually Override the R8 Version
163+
<br/>If upgrading AGP is not an option, you can manually set an external newer R8 version to override the bundled one.
164+
<br/> Open android/build.gradle and add this inside the buildscript {} block then sync and rebuild your project:
165+
```
166+
buildscript {
167+
repositories {
168+
mavenCentral()
169+
maven {
170+
url = uri("https://storage.googleapis.com/r8-releases/raw")
171+
}
172+
}
173+
dependencies {
174+
classpath("com.android.tools:r8:8.2.26")
175+
}
176+
}
177+
```
178+
140179
## Add strict-mode for App-kids
141180
Starting from version **6.1.10** iOS SDK comes in two variants: **Strict** mode and **Regular** mode. Please read more [here](https://dev.appsflyer.com/hc/docs/install-ios-sdk#strict-mode-sdk)
142181

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
- Tested with React-Native **v0.62.0** (older versions might be supported)
1818

1919
## <a id="breaking-changes"> ❗❗ Breaking changes when updating to v6.x.x❗❗
20+
- Starting from version `6.16.0`, Android minimum SDK version is 21.
21+
<br/>Potential Build Issues: If you are using Android Gradle Plugin (AGP) below 8.2.0, you may encounter build errors on Android.
22+
<br/>To resolve this, refer to the [Android Build Error Due to AGP Version](./Docs/RN_Installation.md#android-build-error-due-to-agp-version).
2023

2124
- From version `6.15.1`, upgraded to targetSDKVersion 34, Java 17, and Gradle 8.7 in [AppsFlyer Android SDK v6.15.1](https://support.appsflyer.com/hc/en-us/articles/115001256006-AppsFlyer-Android-SDK-release-notes).
2225

demos/appsflyer-react-native-app/android/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ buildscript {
1111
repositories {
1212
google()
1313
mavenCentral()
14+
maven {
15+
url = uri("https://storage.googleapis.com/r8-releases/raw")
16+
}
1417
}
1518
dependencies {
1619
//classpath("com.android.tools.build:gradle:4.2.1")
17-
classpath('com.android.tools.build:gradle:8.2.0')
20+
classpath('com.android.tools.build:gradle:7.1.3')
1821
// NOTE: Do not place your application dependencies here; they belong
1922
// in the individual module build.gradle files
23+
classpath("com.android.tools:r8:8.2.26")
2024
}
2125
}
2226

demos/appsflyer-react-native-app/android/gradle.properties

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,3 @@ android.enableJetifier=true
2626

2727
# Version of flipper SDK to use with React Native
2828
FLIPPER_VERSION=0.93.0
29-
android.defaults.buildfeatures.buildconfig=true
30-
android.nonTransitiveRClass=false
31-
android.nonFinalResIds=false
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Sun Sep 01 10:19:20 IDT 2024
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)