Gradle build failed with invalid method attribute name index 11190 - android

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?

Related

Jenkins - Execution failed for task ':app:mergeDebugResources'

I am trying to work with Jenkins however I cannot build the apk with it as I am having issue with AAPT2 and Gradle.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Multiple task action failures occurred:
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> Android resource compilation failed
ERROR:C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-3\b478eb984dbbd1317dab9bfd9689b3aa\transformed\appcompat-1.3.0\res\drawable-hdpi-v4\abc_list_divider_mtrl_alpha.9.png: AAPT: error: file not found.
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> Android resource compilation failed
ERROR:C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-3\b478eb984dbbd1317dab9bfd9689b3aa\transformed\appcompat-1.3.0\res\drawable-xhdpi-v4\abc_list_divider_mtrl_alpha.9.png: AAPT: error: file not found.
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> Android resource compilation failed
ERROR:C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-3\b478eb984dbbd1317dab9bfd9689b3aa\transformed\appcompat-1.3.0\res\drawable-mdpi-v4\abc_list_divider_mtrl_alpha.9.png: AAPT: error: file not found.
I already read tons of SO question that may share same issue to my case saying that it has something to do with the file path being too long but I still cannot find any solution.
UPDATE
I tried to change Android Studio Gradle home similar to what Jenkins is using and received similar error which indicates that it may really have something to do with long file path.
I think the final question will be how to change Jenkins Gradle Home?
You need to replace \ with \\ if you are giving path with jenkins in Windows.
May be if file path is too huge or that is the root cause you can try mounting the directory to a short path
EDIT : Based on your modified question :
Open Jenkins dashboard. Navigate to Manage Jenkins-> Configure System. Under the Global properties section add another environment variable named GRADLE_USER_HOME as shown below.
I ran into this exact issue, but unfortunately changing the GRADLE_USER_HOME environment variable did not help, as aapt2 appeared to ignore the change and still used Windows/system32/... for the cache location.
The problem was how I was running Jenkins as a service. In the service.msc settings, it was set to Log On as a Local System account, which set the USER_HOME variables to C:\Windows\System32. Because of this, the reason the error said that the file did not exist was because Jenkins/gradle did not have access to the System32 folder.
My fix was to change the log on method to 'This account', then enter a user account so Jenkins wasn't logged on as system anymore.

Gradle sync failed: Illegal char <:> at index 53 - ionic capacitor

I just finisshed creating my capacitor app which I am trying to build in android studio but every time I run this command npx cap open android and android studio opened I am faced with
Gradle sync failed: Illegal char <:> at index 53:
C:/incidentApp/android/capacitor-cordova-android-plugins/C:-incidentApp-android-capacitor-cordova-android-plugins.iml
(1 m 28 s 869 ms)
Could someone please tell me what this error means and how I can solve it?
Try to locate the written file inside c:/incidentApp/android/capacitor-cordova-android-plugins/. It seems that there is an invalid character : in the file at the position resp. character 53. Remove the illegal character in the file. It may also help if you clean your project, and then build and sync again.

Gradle error trying to run nativescript app on android emulator on mac

I'm trying to run a nativescript app on android using tns run android
I'm always getting gradle error:
FAILURE: Build failed with an exception.
* Where:
Build file:
'/Volumes/My_SSD/myproject/platforms/tempPlugin/kinvey_nativescript_sdk/bui
ld.gradle' line: 28
* What went wrong:
A problem occurred evaluating root project '`kinvey_nativescript_sdk`'.
> Failed to apply plugin [class 'org.gradle.api.plugins.BasePlugin']
> Could not create service of type OutputFilesRepository using ExecutionServices.createOutputFilesRepository().`
I tried the following:
Run ./gradlew --stacktrace but I got this error:
Caused by: org.gradle.cache.LockTimeoutException: Timeout waiting to lock
execution history cache
(/Volumes/My_SSD/myproject/platforms/tempPlugin/kinvey_nativescript_sdk/.gr
adle/5.1.1/executionHistory). It is currently in use by another Gradle
instance.
Owner PID: unknown
Our PID: 50331
Owner Operation: unknown
Our operation:
Lock file:
/Volumes/My_SSD/myproject/platforms/tempPlugin/kinvey_nativescript_sdk/.gra
dle/5.1.1/executionHistory/executionHistory.lock
Deleted .lock files manually and re-ran tns run android but I got the same error again
Run
chmod R+x/Volumes/My_SSD/myproject/platforms/tempPlugin/kinvey_nativescript_sdk
Didn't fix the problem
The app runs fine on ios emulator and but not on android
I was having the same problem, looks to be related with this Gradle issue.
The workaround I found here is to move the project to the home folder (~).

Ionic 3 AAPT error after gradle update: resource fontVariationSettings not found

The problem is that since this morning (I believe, I have not worked yesterday) when I try to run my ionic 3 application on the device I get an AAPT error.
To recreate the problem I started from a scratch app.
I create a simple new ionic application:
ionic start gradleError tabs
Now if I try to run it on my device it works
Let's say I want to add this plugin using simply this two commands:
ionic cordova plugin add cordova-plugin-mauron85-background-geolocation
npm install --save #ionic-native/background-geolocation
Now when I try to run it on my device I get the following Errors:
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
Reading the error output is seems that the problem is this one:
fontVariationSettings not found.
ttcIndex not found.
First fix attempt was made by changing inside "platforms/android/project.properties" the line into:
cordova.system.library.2=com.android.support:support-v4:26+
After trying to run in on device I start to get a bunch of errors which looks like:
/Users/zeno/Desktop/Bachelor/App/gradleError/test/platforms/android/app/src/main/java/com/tenforwardconsulting/cordova/BackgroundGeolocationPlugin.java:563: error: cannot find symbol
#TargetApi(Build.VERSION_CODES.KITKAT)
^
symbol: variable KITKAT
location: class VERSION_CODES
/Users/zeno/Desktop/Bachelor/App/gradleError/test/platforms/android/app/src/main/java/org/apache/cordova/splashscreen/SplashScreen.java:297: error: cannot find symbol
LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
^
symbol: variable MATCH_PARENT
With ate the end:
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
Now following what has been said on the ionic forum I tried to run the following command:
cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=27.0.0
with which I get the same errors as the change I made before.
I tried also to play with the system and the numbers, from 27 to 27.1 to 24 and so on, nothing changed.

Gradle Error for Android Studio

I'm trying out Android Studio on OS X and am running into a mysterious error message. I went through the Google guide to building a simple UI, but when I finished writing the XML file and hit Run in the IDE, I get the following message ("Test2" is the name of the project):
Gradle: Execution failed for task ':Test2:validateDebugSigning'.
> Could not find matching constructor for: org.gradle.tooling.BuildException(java.lang.String)
I have never developed an android app before, so I don't know how common this is. I did a search for this error and found no one encountering the same problem.
I tried the solution from Abhan and I get a new error message:
Error: org.jetbrains.plugins.gradle.settings.GradleSettings cannot be cast to org.jetbrains.plugins.gradle.settings.GradleSettings
It warns you that android plug-in task validateDebugSigning cannot access the debug key. Check your accessibility to the debug.keystore.
On linux or OS X, the default location is ~/.android. On windows, it's in C:\Documents and Settings\.android\ or C:\Users\.android.

Categories

Resources