Andorid Studio: ExecutionException : (integer) -1 is less than minimum integer 0 - android

I updated to Android Studio 3 Canary build 2, which bumped up my build tools like so:
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
Now when I try to build I get this issue:
Error:.../values.xml:3490 (integer) -1 is less than minimum integer 0
Error:java.util.concurrent.ExecutionException:
com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:Execution failed for task ':app:processStagingResources'.
Failed to execute aapt
So I took a look at line 3490 of the file referenced above and got this:
<item name="android:numColumns">auto_fit</item>
Because it references I GridView style, I went to the docs and found that AUTO_FIT has a value of -1
I'm not sure why I'm getting this issue but I've tried cleaning/building, restarting and I still get that issue. Any idea what to try?

You can disable AAPT2 by putting this in your gradle.properties file:
android.enableAapt2=false

Try upgrading your build tools to 26.0.2 or newer, it was a bug in AAPT2, it should be fixed now.
If you're still using an alpha or a beta of AndroidStudio try upgrading to Android Studio 3.0.

Related

Android Studio 3.0 failed mergeDebugResources - error: file not found

I created an empty project and added appcompat-v7-26.1.0 support. I'm getting many errors like that:
C:\Users\username.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\e0aabf040e64856c88683f1511ddf095\res\layout\tooltip.xml: error: file not found.
which lead to:
Error: java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details :app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details
I can solve it by adding property in gradle.properties file
android.enableAapt2=false
... but this is rather workaround than fixing the cause. If you take a look at this missing file path it seems quite long so I was wondering if the path length may be the problem as posted for other issues here. Unfortunately I don't know how can I changed it as most of the length is inside the gradle directory, so even if I change GRADLE_USER_HOME path (C:\Users\username\.gradle in my case) it's not a big profit.
I also tried to set
android.enableBuildCache=true # false didn't work as well
android.buildCacheDir =c:\\temp\\
but with no luck. I'd appreciate a helping hand or any tip in this case.
Here is what I changed In build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:0.4.3'
}
issure here:
https://issuetracker.google.com/issues/36972228
I had similar issue.
Changing gradle runtime from Gradle 4.4.1 to Gradle 4.1 helped.
(no changes in dependencies, if you use Jenkins make sure that environment variables updated correctly gradle --version)
It looks like the problem is gradle is looking in C:\Users\username.gradle\caches for the cached appcompat libraries. I'm assuming that username.gradle doesn't exist? Or is that a typo?
In any case, I had a similar issue, and specifying the gradle user home directory fixed it. In my case, gradle was looking inside C:\Windows\System32\config\systemprofile, and not finding the cache because it didn't exist.
I set an environment variable for GRADLE_USER_HOME so that gradle would cache things in a set location. See this question for a little more detail.

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':mergeDevOnlySlDebugResources' only on Jenkins

When I use Android Studio 3.0 Beta 7 and update my project with the Android Gradle 3.0.0-beta7 plugin my project builds fine in both the debug and rc (proguard enabled) variants.
When I attempt to build on my Jenkins box, I get a bunch of:
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\androidsdk-2.4.12-fullRelease.aar\222313e24d6c4b00972b4191a95e6e2e\res\drawable-xxhdpi-v4\ic_teads_sdk_contact_us.png: error: file not found.
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\c8fedf0a28e83c9ac57e1ac18693c6a0\res\drawable-hdpi-v4\abc_tab_indicator_mtrl_alpha.9.png: error: file not found.
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\android-sdk-ui-2.0.4.aar\0b51ce1d665e491601444168a26000ca\res\drawable-xhdpi-v4\com_appboy_inappmessage_chevron.png: error: file not found.
What went wrong:
Execution failed for task ':mergeDevOnlySlDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
I tried to use AAPT instead of AAPT2 and that still gives me the same problem. My other jenkins projects that are not running this gradle 3 change still run fine. Also the files that can't be found from above are indeed on my machine in the location that AAPT can't find.
Has anyone run into this before?
I've seen error's online about invalid PNG or actual errors from using the new AAPT2, but this is different.
I solved this problem by adding the below line to the gradle.properties file:
android.enableAapt2=false

Android aapt.exe resources expection

This is not a duplicate question. I have already tried all solutions related to this problem. But none of them are worked.
I have imported project to my system and got error.
To overcome with this error i have installed all build tools versions.
This is my build.gradle file.
My target sdk version and compile sdk version and build tool version are same.
I have downgraded the build tool version with specific target and compile sdk versions. But none of them are working for me.
I have also checked that Does it contain any Capital alphabet in values , drawable and other files. But all seems ok.
ERROR :
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
Advanced help would be appreciated !

Android Studio - transformClassesWithMultidexlistForDebug error

After updating from com.android.tools.build:gradle:2.0.0-alpha3 to com.android.tools.build:gradle:2.0.0-alpha6 I got this error:
Error:Execution failed for task ':MyApp:transformClassesWithMultidexlistForDebug'.
> java.util.NoSuchElementException (no error message)
I have multiDexEnabled true, which worked so far (up to alpha3); if I remove it I get another error:
Error:A problem was found with the configuration of task ':MyApp:zipalignDebug'.
> File '/Users/myuser/dev/projects/my-app/MyApp/build/outputs/apk/MyApp-debug-unaligned.apk' specified for property 'inputFile' does not exist.
Any clue?
Note: after updating to alpha6 I also updated distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip in gradle-wrapper.properties and did a project clean + rebuild.
I'll add the answer, since it seems to work for some people.
I discovered that my Android Studio 2.0 Preview was outdated (I was in stable channel). I updated it to the latest version (canary channel). At the moment is the Preview 6.
I also had to disable "instant run" due to other problem I had after updating Android Studio.
Hope it helps!

Execution failed for task ':app:mockableAndroidJar'

I am using local gradle of version 2.4 and IntelliJ IDEA 14.1.3
When I run project from IntelliJ it runs fine but when execute gradle clean build command from command line it gives the flowing exception and build fails.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mockableAndroidJar'.
> java.util.zip.ZipException: invalid entry compressed size (expected 2051 but got 2050 bytes)
This looks like an old ques which is not yet answered yet.
I got into same problem, when my jar files could not be read by Android Studio and it gave me the above mentioned error.
Taking lead from the comment by -Mikhail Boyarsky I changed classpath in build.gradle file to 'com.android.tools.build:gradle:2.2.3'.
Synced project and it started working.
I solved it by changing com.android.tools.build:gradle:2.3.0 version to 2.2.3, then build it with another exception and then I changed the version back to 2.3.0.
Not sure how it works, looks like a gradle bug.

Categories

Resources