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?
Related
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.
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 am trying to connect/register my Android app with GCM, however I am receiving the following error during build
Error:Execution failed for task ':app:mergeDebugResources'.
[string/gcm_defaultSenderId] C:\Users\AndroidStudioProjects\Advanced_Android_Development\app\src\main\res\values\strings.xml [string/gcm_defaultSenderId] C:\Users\AndroidStudioProjects\Advanced_Android_Development\app\build\generated\res\google-services\debug\values\values.xml: Error: Duplicate resources
When I verified both the files,I noticed that the only commonality is gcm_defaultSenderId attribute present in both the files. Can any one help me understand what the issue could be?
I downloaded the google-services.json file after creating a console project in firebase https://console.firebase.google.com
I was able to figure out the issue, When I verified both the files
[string/gcm_defaultSenderId] C:\Users\AndroidStudioProjects\Advanced_Android_Development\app\src\main\res\values\strings.xml [string/gcm_defaultSenderId] C:\Users\AndroidStudioProjects\Advanced_Android_Development\app\build\generated\res\google-services\debug\values\values.xml: Error: Duplicate resources
I noticed that the only commonality is gcm_defaultSenderId attribute present in both the files. The gcm_defaultSenderid was changed in strings.xml to correctly build the package
I followed Facebook's Android dev site to setup Facebook Android projects in Eclipse:
https://developers.facebook.com/docs/guides/mobile/android_hackbook/
I used the "debug" target in build.xml to build using Ant. But I'm getting these errors:
[aapt] E:\Android\facebook-android-sdk\examples\Hackbook\res\layout\token_refresh.xml:15: error: Error: String types not allowed (at 'layout_width' with value 'match_parent').
[aapt] E:\Android\facebook-android-sdk\examples\Hackbook\res\layout\token_refresh.xml:28: error: Error: String types not allowed (at 'layout_width' with value 'match_parent').
BUILD FAILED
C:\Android\android-sdk-windows\tools\ant\build.xml:598: The following error occurred while executing this line:
C:\Android\android-sdk-windows\tools\ant\build.xml:627: null returned: 1
Why is the token_refresh.xml erroring out? I haven't made any changes to the latest facebook sdk that I pulled down from github.
I did change Hackbook's APP_ID to use a new one I created. I have the facebook sdk referenced in this project. I have libs folder in this project.
I open token_refresh.xml and it shows these errors in the log:
NOTE: This project contains resource errors, so aapt did not succeed, which can cause rendering failures. Fix resource problems first.
Failed to convert #color/grey into a drawable
Couldn't resolve resource #string/app_name
Couldn't resolve resource #string/access_token_label
Couldn't resolve resource #string/access_token_expires_label
Couldn't resolve resource #color/grey
Couldn't resolve resource #string/refresh_button
Couldn't resolve resource #string/tip_label
Couldn't resolve resource #string/refresh_token_tip
Exception details are logged in Window > Show View > Error Log
Does anyone know how to fix these problems?
Thank you
Hackbook only works on Android SDK 2.2 +. I had it set to 2.1, so it didn't work. Now it compiles and runs on my AVD 2.2.
I've been trying to install the C2dm module for titanium studio found here: https://github.com/Kuraturpa/titanium-c2dm
I keep having issues. When I set it up as outlined here: http://developer.appcelerator.com/question/38451/c2dm-in-titanium
I keep getting an error that it can't find the module (at runtime). The error reads:
Location: [357, 0] /tmp/module.js Message: Error: Requested module not
found: com.findlaw.titanium.cd2m (/tmp/module.js#357)
I indeed can't find this file anywhere in my stuff, because I don't have a tmp folder in my project. I originally put the xml code from that above forum post in the timodule.xml file and it got me to this runtime error. When I switch it to the tiapp.xml file I get this error:
[ERROR] The 'apiversion' for 'com.findlaw.titanium.c2dm' in the module
manifest is not a valid value. Please use a version of the module that
has an 'apiversion' value of 2 or greater set in it's manifest file
When I try to manually build the module myself using ant, I get:
BUILD FAILED /Users/sammy/Downloads/IGx89-titanium-c2dm-3b05b8a
2/build.xml:9: Cannot find /Library/Application
Support/Titanium/mobilesdk/osx/1.8.0.1/module/android/build.xml
imported from /Users/sammy/Downloads/IGx89-titanium-c2dm-3b05b8a
2/build.xml
I checked, and the build.xml file is in the folder shown in the error. I'm kind of at a loss as to what to do here...
That module does not support the version of Titanium Mobile you are using (1.8.0.1 or higher). You must either update it yourself, or find another C2DM module.
The guide for porting to 1.8.0.1 is available here:
http://docs.appcelerator.com/titanium/2.0/index.html#!/guide/Android_Module_Porting_Guide_for_1.8.0.1