I added Lyft android SDK dependency in my app in dependency section of build.gradle file as below
implementation "com.lyft:lyft-android-sdk:1.0.3
But I am getting below error while running app on mobile device:-
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDevDebug'.
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 3m 33s
I try to solve above issue by adding multiDexEnabled true in default config of app gradle, but it doesn't work.
I am using Android Studio 3.0.1 and gradle 4.1 version.
I investigated issue more by enabling stack trace in gradle build process and looking out stack trace log.
In stack trace I found there is a duplicate class from org.jetbrains.annotations package which is coming from two different dependency module. one dependency module was from kotlin dependency and one was from lyft sdk dependency module. So I added Lyft sdk dependency as like below in build.gradle and it works for me.
implementation ("com.lyft:lyft-android-sdk:1.0.3"){
exclude group: 'org.jetbrains', module:'annotations-java5'
}
Related
I am working on a react native project where I had to integrate zoom video sdk in it. First I was working on zoom version 1.2.0, then I had to upgrade it to 1.5.3. after upgrading it the app build and work fine in debug mode, but when I tried to generate an app or do a bundle release it's returning this error.
`* What went wrong:
Execution failed for task ':app:mergeDexRelease'.
A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingTaskDelegate
There was a failure while executing work items
> A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingWorkAction
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Type a.a is defined multiple times: /Users/macbookpro/Desktop/healing-center-mobile/android/app/build/intermediates/external_libs_dex/release/mergeExtDexRelease/classes.dex, /Users/macbookpro/Desktop/healing-center-mobile/android/mobilertc/build/.transforms/e16cb3969562dbd5409148a5e09af52c/transformed/jetified-mobilertc-runtime/classes.dex
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
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.`
I search for it and there where many solutions like adding
dependenciesInfo { // Disables dependency metadata when building APKs. includeInApk = false // Disables dependency metadata when building Android App Bundles. includeInBundle = false } in app/build.gradle
or add multiDexEnabled true and implementation 'androidx.multidex:multidex:2.0.1'
or add the exclude model to the project in app/build.gradle implementation (project(':mobilertc')) { exclude module: 'duplicated module' }
or by adding to build.gradle implementation("com.google.guava:guava:24.0-jre")
I also tried to invalidate caches from android, delete node modules and install it again.
But always the same error.
So anyone can help with it?
I faced same issue.
In android/app/build.gradle
remove this line:
implementation 'us.zoom.videosdk:ZoomVideoSDK:1.5.3'
Build again => Solved this problem
Hope it helpful
I am developing a flutter app for Android. For that I am using a realm database and I am using the realm dependency for flutter https://realm.io/realm-flutter/ to read data from it. This realm database is generated by some android library com.my_realm_generating_library.
My problem is now, that com.my_realm_generating_library imports the realm library for kotlin https://realm.io/realm-kotlin/ and because I am importing the realm library for flutter, the kotlin library is included a second time.
When I run flutter build apk I get this result:
Running Gradle task 'assembleRelease'...
Realm binaries for realm#0.8.0+rc already downloaded
Realm install command finished.
ERROR:/home/user/.gradle/caches/transforms-3/c90739e9642326489e851a982778d55f/transformed/jetified-realm-android-library-10.6.1-runtime.jar: R8: Type io.realm.BuildConfig is defined multiple times: /home/user/.gradle/caches/transforms-3/c90739e9642326489e851a982778d55f/transformed/jetified-realm-android-library-10.6.1-runtime.jar:io/realm/BuildConfig.class, /home/user/projectname/build/realm/intermediates/runtime_library_classes_jar/release/classes.jar:io/realm/BuildConfig.class
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:minifyReleaseWithR8'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.R8Task$R8Runnable
> Compilation failed to complete, origin: /home/user/.gradle/caches/transforms-3/c90739e9642326489e851a982778d55f/transformed/jetified-realm-android-library-10.6.1-runtime.jar:io/realm/BuildConfig.class
* 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 8s
Running Gradle task 'assembleRelease'... 9,2s
Gradle task assembleRelease failed with exit code 1
When I remove the realm library from my pubspec.yaml, everything compiles. But I need access to my realm file from my kotlin code and my dart/flutter code. Is there some way to fix such dependency conflicts, where flutter uses a library and kotlin the same and in the end none of them work?
What I tried so far:
I removed realm: ^0.8.0+rc from the dependencies section of my pubspec.yaml. Then everything compiles. This is not an option because I need this library in my dart code.
I could also remove implementation "com.my_realm_generating_library" from android/app/build.gradle. But I also need this library in my kotlin code to generate my realm database. Therefor this is also no option.
Amazingly I was able to find an answer for my question, although I was unable to find one anywhere online so far. Hopefully this helps some people who get into the same trouble as I have.
Firstly, I navigated into my projectname/android and ran ./gradlew app:dependencies --console=rich to find all the dependencies of com.my_realm_generating_library.
In my case, the only dependency of com.my_realm_generating_library was io.realm:realm-android-library:10.13.0. I knew that this package will be provided by the realm-flutter dependency. Therefor I knew, that I can just force disable all transitive dependencies of com.my_realm_generating_library.
The code I put in my build.gradle under the dependencies section was this:
implementation("com.my_realm_generating_library") {
transitive = false
}
Now everything works. Hope this helps!
How can a Zip file be created that contains dependencies used in an Android application?
Context
The Zip file that contains all the the application dependencies is used by Nexus IQ server. This product can analyze dependencies to determine if there are any security vulnerabilities or licensing issues.
Problem
In earlier versions of Gradle (e.g. 3.3 and below), the following Gradle task was used to create a Zip file of dependencies.
task dependenciesZip(type: Zip) {
from configurations.compile
}
After upgrading to Gradle 4.1, the task above stopped working.
One issue with the task above is the configuration that is used. When migrating to Gradle 4.1, all the application dependencies were changed from compile to implementation. As a result, the compile configuration did not contain any dependencies to include in the Zip file.
In an attempt to fix this problem, the task above was updated to the following:
task dependenciesZip(type: Zip) {
from configurations.implementation
}
However, the above task fails to run with the following error:
./gradlew :app:dependenciesZip
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:dependenciesZip'.
> Resolving configuration 'implementation' directly is not allowed
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
This failure is caused by an IllegalStateException that is thrown when Gradle attempts to resolve the implementation configuration. The isCanBeResolved() method returns false for the implementation configuration.
Questions
What configuration (or set of configurations) should be used to capture the dependencies used in an Android application?
How can a task resolve the dependencies in a configuration?
task copyDependencies(type: Copy) {
configurations.getAt("implementation").setCanBeResolved(true)
println("implementation canBeResolved change to :"+configurations.getAt("implementation").canBeResolved)
from configurations.getAt("implementation")
into ".\\dependencies"
}
I am attempting to break a large project into sub-projects. Mostly its working despite the many bug related to dependency handling in grade, however Ive run across a conflict, that I can't get a graph to resolve.
What I expect is to be abel to get a graph of dependencies so I can track down which library has the two conflicting dependencies, but the command stops before the dependency graph is printed for me to review.
I am unsure if this is somehow by design or just another bug in gradle or the android plugin.
This is my output.
$ ./gradlew androidDependencies
Defining custom 'clean' task when using the standard Gradle lifecycle plugins has been deprecated and is scheduled to be removed in Gradle 3.0
Incremental java compilation is an incubating feature.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':xlivestream'.
> Could not resolve all dependencies for configuration ':xlivestream:_debugCompile'.
> A conflict was found between the following modules:
- com.android.support:support-annotations:23.4.0
- com.android.support:support-annotations:23.1.1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Can anyone tell me how I'm supposed to get a dependency graph, to resolve this problem?
The error occurs because the configuration parameter resolutionStrategy.failOnVersionConflict() is enabled.
However, there appears to be a bug in gradle that prevents the dependency task from listing dependencies, because that parameter fails the build before it can execute.
I just switched to Android Studio 2 and I'm trying to use Google Play services in my app. But I faced a really strange from the very beginning. Adding to Gradle.build such dependencies:
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0
cause error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> com.android.manifmerger.ManifestMerger2$MergeFailureException: java.io.FileNotFoundException: /media/valentyn/Seagate Backup Plus Drive/workspace/Studio Projects
16.02.16/LocalVenues/app/build/intermediates/exploded-aar/com.google.android.gms/play-services-maps/8.4.0/AndroidManifest.xml (No such file or directory) Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Can it be some conflict with installed libraries in SDK Manager or what else?
I had the same kind of problem, caused by the new Instant Run in Android Studio 2, I solved it with:
Build > Rebuild Project
Run again.
The funny thing that this issue was related to NTFS file system of my portable driver. After moved my project, this problem was solved.