Closed Negatives-One closed 1 year ago
add this to your gradle:
implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
This doesn't work in my case, I already tried all related troubleshooting from Issues section.
I've tried all these solutions too
Nothing solves my problem so far.
OK, how does your gradle look?
Gradle:
allprojects {
buildscript {
repositories {
google()
jcenter()
}
dependencies {
// If you are changing the Android Gradle Plugin version, make sure it is compatible with the Gradle version preinstalled with Unity
// See which Gradle version is preinstalled with Unity here https://docs.unity3d.com/Manual/android-gradle-overview.html
// See official Gradle and Android Gradle Plugin compatibility table here https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
// To specify a custom Gradle version in Unity, go do "Preferences > External Tools", uncheck "Gradle Installed with Unity (recommended)" and specify a path to a custom Gradle version
classpath 'com.android.tools.build:gradle:4.0.1'
}
}
repositories {
google()
jcenter()
flatDir {
dirs "${project(':unityLibrary').projectDir}/libs"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Main Template:
apply plugin: 'com.android.library'
**APPLY_PLUGINS**
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
**DEPS**}
android {
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion **MINSDKVERSION**
targetSdkVersion **TARGETSDKVERSION**
ndk {
abiFilters **ABIFILTERS**
}
versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'
consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
}
lintOptions {
abortOnError false
}
aaptOptions {
noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
}**PACKAGING_OPTIONS**
}**REPOSITORIES**
**IL_CPP_BUILD_SETUP**
**SOURCE_BUILD_SETUP**
**EXTERNAL_SOURCES**
and adding this as suggested?
implementation 'com.google.guava:guava:31.1-android'
This results in the same error
Trying combinations of gradle implementation and with or without AVPRO guava file, nothing works as it should.
I can only actually build without the gradle implementation lines and without the AVPRO guava file
OK, well this does seem to be a common problem and there seem to be a few solutions that I have found online. I'll list a few suggestions. The fix can be a bit of a lottery based on which version is used by the other asset, and which one is loaded first. I'm afraid its just a case of trial and error. Please let me know if any of these work for you. More info: https://blog.gradle.org/guava
Delete AVProVideo\Runtime\Plugins\Android\guava-27.1-android.jar.
Player Settings -> Publishing Settings -> Build -> Custom Main Gradle Templete Checked.
Edit the Assets\Plugins\Android\mainTemplate.gradle file and modify dependencies to:
Code (JavaScript):
dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation("com.google.guava:guava:31.0.1-android") DEPS} Continue to compile, if the compilation reports an error, restart Unity and try again.
. We just found a similar way to do this, but using Google's External Dependency Manager for Unity. Noting it here for other devs:
added a file Asets/AVProVideo/AVProDependencies.xml with
Changed Minimum API Level to Android 5.0
Open build.gradle file.
Do Not replace! Just add this line into dependencies{}:
implementation 'com.google.guava:guava:
add these two implementations to your app level build.gradle / app/build.gradle
implementation 'com.google.firebase:firebase-inappmessaging-display:17.2.0' implementation 'com.google.guava:guava:27.0.1-android'
For me, nothing worked. The only thing that fixed it magically was to update the desugaring library to the matching for my AGP version:
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.0'
None of these solutions work for me, I always have to choose which one will work, whether it's going to be AVPRO or Firebase Analytics, both together seem to be impossible.
Is there any alternative solution? perhaps replace AVPRO's guava-31.1-android.jar with something else?
Its a requirement of Exoplayer, so our hands are tied there. They might be able to provide some more suggestions perhaps?
Could you try building on a specific project?
It's just an empty project with AVPRO and Firebase Analytics, which email could I send it to?
unitysupport@renderheads.com
I sent an email, with a test project, as I mentioned before. I await your reply with the result. Thanks
I have the same problem!
@Paulo-Aragao, Have you tried all of the above things that have worked for other people?
@Ste-RH - long term would it be possible to rename exoplayer guava files and references to those (similarly to how we did with exoplayer itself)?
yes, but without success at all
Seems like it is impossible to build for android with Firebase 1.0.7 and avpro 2.7.3. I'm trying it in a empty project with unity 2021.3.15f1
@Chris-RH Do you see any possible solution? this asset was expensive, and I need to make it work together with firebase
I have the same issue without any luck @Chris-RH
Have you tried the adapting the solution at the bottom of this: https://stackoverflow.com/questions/61480581/duplicate-class-found-in-modules-guava-26-0-android-jar-and-guava-jdk5-17-0-jar They post a git link to their gradle.
I updated firebase package to version 11.0.0, added "implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'" in custom gradle and deleted "app-1.8. 7-unity-support.aar".
This so far has solved my problem.
@Negatives-One I added the 11.0.0 version package, but "app-1.8.7-unity-support.aar" is not visible. Where is "app-1.8.7-unity-support.aar"?
@Negatives-One, Thank you. It seems to be very hit and miss as to what actually solves the issue for an individual project. What made you try deleting "app-1.8. 7-unity-support.aar" ?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Uncheck the android under select platform for the plugin as marked in the attached screenshot.
It worked for me.
Uncheck the android under select platform for the plugin as marked in the attached screenshot.
It worked for me.
This will work for me but, if I setup the media player to EXO Player on android, the the app will crash. Is there a known solution for this error? Im trying to build for Android Cardboard. Thanks
Describe the issue It is impossible to generate an android build with AVPro Video and Firebase Analytics in the same project. A duplicate classes error occurs, and when I delete the guava-31.1-android from AVPro, the build works, but the videos do not play. What is the best way to deal with this problem?
Your Setup (please complete the following information):
To Reproduce
Screenshots