After upgrading to android studio 3.0.1 the string resources with $ in their name
like: <string name="$KEY$">value</string>
throw an error
Error:(615, 3) error: resource 'string/$KEY$' has invalid entry name '$KEY$'. Invalid character '$KEY$'.
trace is:
AGPBI: {"kind":"error","text":"error: resource
\u0027string/$KEY$\u0027 has invalid entry name \u0027$KEY$\u0027.
Invalid character
\u0027$KEY$\u0027.","sources":[{"file":"../src/main/res/values-es/strings.xml","position":{"startLine":559,"startColumn":2,"startOffset":60748,"endColumn":54,"endOffset":60800}}],"original":"","tool":"AAPT"}
Aapt2 is enabled by default when you use android plugin for gradle 3.0.
You can fix your issue by setting android.enableAapt2=false in your gradle.properties
Related
The error message is the following: android 'attr/value' with config ''
Here is the version setup:
compileSdkVersion = 27
buildToolsVersion = "27.0.3"
minSdkVersion = 21
targetSdkVersion = 27`
The error message specifies the name of loading-dots library, which has really less resources which doesn't interfere with the other resources.
The question is now how to parse this error message properly to a normal human understandable language to be able to find where the issue comes from.
What does mean?
- "attr/value"
- "with config ''"
Here is the complete log message
:app:generateDebugResources
AGPBI: {"kind":"error","text":"error: duplicate value for resource \u0027attr/value\u0027 with config \u0027\u0027.","sources":[{"file":"/Users/karate/.gradle/caches/transforms-1/files-1.1/loading-dots-1.0.2.aar/53c3c73936c7c0b67d125304a8d501c0/res/values/values.xml","position":{"startLine":3,"startColumn":4,"startOffset":619,"endColumn":60,"endOffset":675}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: resource previously defined here.","sources":[{"file":"/Users/karate/.gradle/caches/transforms-1/files-1.1/loading-dots-1.0.2.aar/53c3c73936c7c0b67d125304a8d501c0/res/values/values.xml","position":{"startLine":3,"startColumn":4,"startOffset":619,"endColumn":60,"endOffset":675}}],"original":"","tool":"AAPT"}
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
:app:mergeDebugResources FAILED
The library has an issue, it clashes with a system xml attribute. That's why you are getting the error. Moreover, the repo you've linked to is backwards as it doesn't have a values.xml try to change the compile version to a lower figure. Maybe
compile 'com.eyalbira.loadingdots:loading-dots:1.0.0'
I have an app which I'm trying to compile with my original package name, very similar to this: com.mypackage.name_.app'
The app compiled successfully until now, which I migrated to the newest versions of Gradle and I'm compiling with API 24. Previously I used old versions of Gradle and API 23.
Now, when trying to compile that app, I'm getting this error:
APT: error: attribute 'package' in tag is not a valid Java package name: 'com.mypackage.name_.app'.
.
.
Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
.
.
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:794)
I found here that AAPT2 doesn't allow underscore in the end of a portion of your package name: All of my android studio projects and all new ones give me errors coming from the debug android manifest file
But then, what happens if you previously compiled and released into Google Play an app with a underscore in the end of a part of your package name? For example I found this example: https://play.google.com/store/apps/details?id=com.mobincube.tarifas_taxi_.sc_35K1XV
It is released into Google Play with this package name portion ".tarifas_taxi_."
How can that developer (and me) compile now our apps with underscore in that position?
AAPT2 does not allow package names with 'words' ending or starting with the underscore character.
Here for the package "com.mypackage.name_.app" the offending word is "name_". Remove the underscore or use "name_foo" (underscores are allowed in the middle of the word) to make is work.
There's an open issue on the issue tracker for this, it's being looked at by the AAPT2's owner.
More info: https://issuetracker.google.com/68468089
i am using cordova for my application and using inAppBrowser plugin, before using this plugin cordova build android --release command was working properly but after adding this plugin it is showing error, if i am not giving --release it working properly means in the debug mode there is no issue.
The error which i am getting is as follow
/Users/mukesh/Documents/code/teamworkCordova/xyz/platforms/android/src/org/apache/cordova/inappbrowser/InAppBrowser.java:555: Error: Expected resource of type id [ResourceType]
actionButtonContainer.setId(1);
~
/Users/mukesh/Documents/code/teamworkCordova/xyz/platforms/android/src/org/apache/cordova/inappbrowser/InAppBrowser.java:563: Error: Expected resource of type id [ResourceType]
back.setId(2);
~
/Users/mukesh/Documents/code/teamworkCordova/xyz/platforms/android/src/org/apache/cordova/inappbrowser/InAppBrowser.java:587: Error: Expected resource of type id [ResourceType]
forward.setId(3);
~
/Users/mukesh/Documents/code/teamworkCordova/xyz/platforms/android/src/org/apache/cordova/inappbrowser/InAppBrowser.java:610: Error: Expected resource of type id [ResourceType]
edittext.setId(4);
~
/Users/mukesh/Documents/code/teamworkCordova/xyz/platforms/android/src/org/apache/cordova/inappbrowser/InAppBrowser.java:633: Error: Expected resource of type id [ResourceType]
close.setId(5);
~
/Users/mukesh/Documents/code/teamworkCordova/xyz/platforms/android/src/org/apache/cordova/inappbrowser/InAppBrowser.java:679: Error: Expected resource of type id [ResourceType]
inAppWebView.setId(6);
~
Explanation for issues of type "ResourceType":
Ensures that resource id's passed to APIs are of the right type; for
example, calling Resources.getColor(R.string.name) is wrong.
The latest release of the Inappbrowser plugin has several "errors" my Android Studio (version 1.4) complains about when building a release APK.
This on one of them.
The only way i found to get around this issue was to modify the content of
InAppBrowser.java
I changed every occurence of
object.setId(int) to
object.setId(Integer.valueOf(int))
for example: inAppWebView.setId(6) -> inAppWebView.setId(Integer.valueOf(6))
Everybody who finds a better (without manipulating the source) solution is welcome.
These "errors" are Lint errors, and it's because lint isn't sure that the number 6 is really the number 6, which is why you need to make sure that you do Integer.valueOf(int) on every object.setId.
I fixed this on the platform level so that it will no longer cause the compilation to fail, but to make lint happy, we will probably change the source so Integer.valueOf is used.
I closed Android Studio, then open it again and tried to run the app and suddenly for some reason gradle build fails.
This is the error:
Error:Invalid method attribute name index 11190 in class file org/gradle/api/internal/tasks/DefaultTaskCollection
Why?
This will probably sound silly but I have no idea how to make the application work.
tutorial for in-app billing
Just like the tutorial says I downloaded the package, I found the files. The problem is there's no project file and I can't get it to work in eclipse.
Anyone used the example app?
I've used it successfully...what seems to be the problem? Once you download the files, bring the project into Eclipse by select "Newn Android Project", "Create project form existing source" and the "Finish." From there, follow the directions regarding changing the package name, etc...
As far as I can determine, the sample Dungeons in-app billing project that I downloaded via Android SDK Manager, does not even compile (this seems to have been fixed, see my comments later in this message..).
As a check, I ran a find command to search for one of the missing resources:
/cygdrive/k/android-sdk-windows/extras/google/play_billing $ find . -name '*.xml' -exec grep edit_payload_title {} \; -print
android:text="#string/edit_payload_title" />
./res/layout/edit_payload.xml
/cygdrive/k/android-sdk-windows/extras/google/play_billing $
As you can see, the resource #string_edit_payload_title is referenced once, but never defined in any of the xml files..
Description Resource Path Location Type
error: Error: No resource found that matches the given name (at 'background' with value '#color/screen_background'). item_row.xml /Dungeons/res/layout line 20 Android AAPT Problem
error: Error: No resource found that matches the given name (at 'background' with value '#color/screen_background'). main.xml /Dungeons/res/layout line 20 Android AAPT Problem
error: Error: No resource found that matches the given name (at 'prompt' with value '#string/select_item'). main.xml /Dungeons/res/layout line 52 Android AAPT Problem
error: Error: No resource found that matches the given name (at 'text' with value '#string/buy'). main.xml /Dungeons/res/layout line 47 Android AAPT Problem
error: Error: No resource found that matches the given name (at 'text' with value '#string/edit_payload_title'). edit_payload.xml /Dungeons/res/layout line 25 Android AAPT Problem
error: Error: No resource found that matches the given name (at 'text' with value '#string/edit_payload'). main.xml /Dungeons/res/layout line 58 Android AAPT Problem
error: Error: No resource found that matches the given name (at 'text' with value '#string/items_for_sale'). main.xml /Dungeons/res/layout line 34 Android AAPT Problem
error: Error: No resource found that matches the given name (at 'text' with value '#string/items_you_own'). main.xml /Dungeons/res/layout line 64 Android AAPT Problem
error: Error: No resource found that matches the given name (at 'text' with value '#string/recent_transactions'). main.xml /Dungeons/res/layout line 80 Android AAPT Problem
error: Error: No resource found that matches the given name (at 'textColor' with value '#color/error_message'). main.xml /Dungeons/res/layout line 28 Android AAPT Problem
** UPDATE ** I just downloaded it again and it seems to be resolved. At least, it builds and deploys now.. And the string definitions seem to be in place now..
/cygdrive/k/android-sdk-windows/extras/google/play_billing $ find . -name '*.xml' -exec grep edit_payload_title {} \; -print
android:text="#string/edit_payload_title" />
./res/layout/edit_payload.xml
<string name="edit_payload_title">Edit the developer payload associated with this purchase</string>
./res/values/strings.xml