First I would like to state that I have built successfully for iOS.
The laconic documentation says : ./gradlew installDebug.
I found no information about the needed environnement for building Android ejected apps, so the build fails with this error
> Task :app:processDebugManifest FAILED
/Users/laurent/Work/fame/v0/fameapp/android/app/src/main/AndroidManifest.xml:22:18-91 Error:
Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:48:3-367:17 to override.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:48:3-367:17 to override.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 8m 56s
509 actionable tasks: 479 executed, 30 up-to-date
This “Manifest merger error” was fixed by adding in application
> Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Program type already present: androidx.versionedparcelable.CustomVersionedParcelable
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: androidx.versionedparcelable.CustomVersionedParcelable
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 49s
Is there someone at @expo or here that was able to build successfully an ejected SDK34 app for Android ? In that case, which versions of tools (android studio, gradle, android sdk tools …) are needed ?
@lc3t35 after a lot of trial and error with updating to 33 and now updating to 34, I found the best combo for gradle is wrapper settings w gradle dist 4.10.2 and build tools 3.3.0 (or 3.3.1, 3.3.2)
make sure you have this in your app build.gradle under dependencies:
another thing to try after making the above changes is File → Invalidate Caches / Restart and/or in the .idea/ dir remove modules.xml file and caches dir, then run gradle sync or restart AS
So the first tip is : don’t update gradle to 5.x as suggested by Android Studio…
In order to install a previous version of gradle on OSX, as it is not provided by homebrew, I used the excellent sdkman :
% curl -s "https://get.sdkman.io" | bash
% sdk install gradle 4.10.3
% gradle --version
Welcome to Gradle 4.10.3!
Here are the highlights of this release:
- Incremental Java compilation by default
- Periodic Gradle caches cleanup
- Gradle Kotlin DSL 1.0-RC6
- Nested included builds
- SNAPSHOT plugin versions in the `plugins {}` block
For more details see https://docs.gradle.org/4.10.3/release-notes.html
------------------------------------------------------------
Gradle 4.10.3
------------------------------------------------------------
Build time: 2018-12-05 00:50:54 UTC
Revision: e76905e3a1034e6f724566aeb985621347ff43bc
Kotlin DSL: 1.0-rc-6
Kotlin: 1.2.61
Groovy: 2.4.15
Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM: 1.8.0_131 (Oracle Corporation 25.131-b11)
OS: Mac OS X 10.13.6 x86_64
I noticed I have an additional item before com.facebook.react:react-native:34.0.0 :
api 'org.webkit:android-jsc:r245459' // needs to be before react-native
api 'com.facebook.react:react-native:34.0.0'
I removed it and gave it a try with Android Studio 3.4.
The current status of build is :
> Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Program type already present: androidx.versionedparcelable.CustomVersionedParcelable
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: androidx.versionedparcelable.CustomVersionedParcelable
you don’t need to install gradle, AS will do it for you whenever you modify the wrapper settings dist (you can see all the versions under your /android/.gradle dir)
check and make sure you have the latest versions of your RN modules in package.json, you may need to update versions or even downgrade to be compatible w expo 34 (run expo install ... to install correct versions)
delete node_modules and android/.gradle dir, then do yarn install then gradle sync or restart of AS
One thing I should add here that I’ve noticed caused some problems for others →
When opening the project, Android Studio may prompt you to upgrade the version of Gradle or other build tools, but don’t do this as you may get unexpected results. ExpoKit always ships with the latest supported versions of all build tools. (from our docs)