I'm working on an android application with Xamarin and I keep getting this error when I try to build.
Error Error in obj\Debug\130\lp\0\jl\bin\classes.jar:com/getkeepsafe/relinker/BuildConfig.class:
Type com.getkeepsafe.relinker.BuildConfig is defined multiple times: obj\Debug\130\lp\0\jl\bin\classes.jar:com/getkeepsafe/relinker/BuildConfig.class, obj\Debug\130\lp\132\jl\bin\classes.jar:com/getkeepsafe/relinker/BuildConfig.class
Compilation failed
java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\130\lp\0\jl\bin\classes.jar
I've tried looking for duplicates in packages, deleting obj and bin folders, clean+build and rebuild and many other solutions from the internet and nothing seems to solve it.
Related
We have started to see random errors in a Xamarin Android build in Azure DevOps that appear to be related to the localization of resource files:
/Users/runner/work/1/s/Apps/MyApp/MyApp.Droid/obj/Release/lp/187/jl/res/values-hu/values.xml(1): error APT2254: xml parser error: no element found.
/Users/runner/work/1/s/Apps/MyApp/MyApp.Droid/obj/Release/lp/187/jl/res/values-hu/values.xml : error APT2261: file failed to compile.
/Users/runner/work/1/s/Apps/MyApp/MyApp.Droid/obj/Release/lp/187/jl/res/values-hu/values.xml(1): error APT2254: xml parser error: no element found.
/Users/runner/work/1/s/Apps/MyApp/MyApp.Droid/obj/Release/lp/187/jl/res/values-hu/values.xml : error APT2261: file failed to compile.
We don't support localization in our app so I don't understand why the build is trying to create localized versions of the resources. We still see the error even if we specify <AndroidResgenExtraArgs>-c en</AndroidResgenExtraArgs> in the project.
The build doesn't always fail and when it does it fails for different language codes. We don't see the issue when building locally but this could because we would normally be building for debug.
Have we misunderstood what is happening here? What could be the cause of the issue?
In old times of Android Studio, when I had compilation error and something was wrong resources I could quickly click on the error and was pointing me to the file. Now I’m getting error com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed but there is nothing to click that takes me quickly to the file to fix an error. Can I find these links somewhere?
You can find the issue on your project using the build report on Android Studio. You just need to switch between views:
This view will show the gradle build logs, and most likely will contain the resources issue.
I have an old android project that is having compilation problems. I've added a gradle.properties file to root with a single line:
android.enableAapt2 = false
However, I'm still getting this error:
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT error: check logs for details
Which doesn't make sense to me because I've disabled aapt2 and it still seems to be using it. In addition, I've checked every log I can find with no additional information found on what is actually breaking.
As for your first question, the build is giving you an AAPT error, which might be coming from AAPT(1), not just AAPT2, that's why disabling AAPT2 doesn't "fix" it.
Secondly, disabling AAPT2 is not a solution. AAPT2 is telling you there's something wrong with your files. It fails the build early so that your app doesn't crash at run-time (which AAPT would silently allow).
Lastly, it's possible that you modified something in between the builds or that it didn't build in the past either. A way to figure out what the problem is, is to check the logs. If you're having trouble finding them in Android Studio (they will be in different places for different versions of Android Studio, Android Gradle Plugin and Gradle), an easy way to generate it is to go to the Terminal window in Android Studio and run "gradlew clean assembleDebug". The errors from AAPT/AAPT2 should be just above the stacktrace.
I'm trying to build my project for a class assignment and I do not know why I am getting this build error. It makes very little sense to me.
Here's the entire message:
Warning:Exception while processing task java.lang.RuntimeException: java.lang.AssertionError: com.android.jack.library.LibraryIOException: I/O error when accessing file 'C:\Users\Name\Downloads\Fall 2016\CSXXX\assignments\assignment1\app\build\intermediates\packaged\androidTest\debug\classes.zip': Failed to delete directory 'C:\Users\Name\AppData\Local\Temp\vfs-1473281485250-0'
:app:compileDebugAndroidTestJavaWithJack FAILED
Error:Execution failed for task ':app:compileDebugAndroidTestJavaWithJack'.
> java.lang.RuntimeException: java.lang.AssertionError: com.android.jack.library.LibraryIOException: I/O error when accessing file 'C:\Users\Name\Downloads\Fall 2016\CSXXX\assignments\assignment1\app\build\intermediates\packaged\androidTest\debug\classes.zip': Failed to delete directory 'C:\Users\Name\AppData\Local\Temp\vfs-1473281485250-0'
Is this just a test failure? or is there a bigger issue?
Had the same problem, my Antivirus software seemed to be causing it.
I hope that this issue will be fixed within Android Studio soon.
Disabling antivirus altogether is obviously a bad idea, but if you can whitelist %TEMP%/vfs* in your antivirus it should do the trick (disclaimer: Do so at your own risk, this is still a bit of a security gap).
Alternatively you could disable jack and use the legacy toolchain for your Android project.
I have no Idea what is happening, last time when I finished my app I build its release apk and all was working just fine as expected but now today when I tried to make that pproject again and to make another apk I am getting the following error.
Error:Execution failed for task ':app:mergeDebugResources'.
Crunching Cruncher common_signin_btn_icon_pressed_light.9.png failed, see logs
I have no idea how to resolve it I have serached and found restarting Android studio and clean the project would remove it , doing this many times has no effect on this error. I have even restarted my machine but the condition of error in same.
In the logs I have seen that this png file is from the library I added , so just for testing I removed that library and tried to build then it started to give me same error with different png file name in other library. So how to fix this issue ?
My Questions are :
How can this issue be Solved ?
Have some one faced this problem too ?
Is this problem has been reported to google ?
Why in android we do not have any stable platform for development as IOS have ?
Try to remove "builds" folders and do rebuild. But soon, the whole thing in a long file name. Read this answer. By the way, you looked logs? Maybe this is not the PNG? You have not sent the log and did not specify the version Gradle.
Believe me, iOS developers have own problems.