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.
Related
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.
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 (~).
I'm trying to get my app on an android device. When I run
tns run android
I get this error :
/Users/coreelements/Projects/nativescript/myapp/platforms/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:32: AAPT: error: resource
drawable/icon (aka nl.coreelements.myapp:drawable/icon) not found.FAILURE: Build failed with an exception.* What went wrong:
Execution failed for task ':app:processDebugResources'.
Failed to process resources, see aapt output above for details.
I've already tried regenerating the app and splashes :
tns resources generate icons src/images/appicon.png
tns resources generate splashes src/images/appicon.png
What am I missing? I've also tried to buid/run in App Studio.
Just wrapping up the answer from #fransyozef:
App_Resources/Android/src/main/AndroidManifest.xml should point to the right drawable, in this case replacing android:icon="#drawable/icon" with android:icon="#drawable/appicon" solved the issue.
The solution above did not work for me, what did work is change
android:icon="#drawable/icon" to android:icon="#drawable/fileName", so replace /icon with /fileName of the image that is stored there.
While trying to release via code-push on VSTS getting the following error:
Unable to find or read "config.xml" in the CWD. The "release-cordova" command must be executed in a Cordova project folder
2017-11-21T09:22:35.1120732Z [Error] Unable to find or read "config.xml" in the CWD. The "release-cordova" command must be executed in a Cordova project folder.
2017-11-21T09:22:35.1200947Z ##[debug]Finished Building Command: node d:\a\_tasks\CodePushReleaseCordova_f5990527-f512-4c14-9f8e-1254240dc3cb\1.0.5\node_modules\code-push-cli\script\cli logout
2017-11-21T09:22:36.2276558Z ##[debug]task result: Failed
2017-11-21T09:22:36.2295997Z Command failed: release-cordova
2017-11-21T09:22:36.2326120Z ##[debug]Processed: ##vso[task.complete result=Failed;]Command failed: release-cordova
Here's the screenshot attached of the problem:
For the detailed log: https://drive.google.com/open?id=1SMk0N47A8OGm5PDUk5e86sPygmMAjD5X
In order to trouble shooting for this error:
Please add two tasks before CodePush task:
1) Add npm task with this setting
https://drive.google.com/open?id=1H4bWAMruzfOs90xOLxgjadAd7DihaVH4
2)After npm task, add Command Line task with below setting
https://drive.google.com/open?id=1bxd54kVgW4zGRwhsH_JKz_cjc1wYZ-No
Then check if the Cordova command can execute correctly
Then if you have specified the variable Build.SourceDirectory
as $(Build.SourcesDirectory)\path to your app
remove it (the variable) as you have already specified the path in GET SOURCES
You do not need to add the “Build.SourceDirectory” variable in this condition. And now, you specified the working directory to “d:\a\3\s\app path” which should not exist on the build agent, but the task didn’t report that error.
The task indicated that it cannot find the config.xml since the file exist under “d:\a\3\s” rather than “d:\a\3\s\app path”.
Thus remove the “Build.SourceDirectory” variable and run the build to check
The above steps should work for the given problem
I used to have the following gradle build task:
task buildWebApp(type: Exec) {
executable = Os.isFamily(Os.FAMILY_WINDOWS) ? "grunt.cmd" : "grunt"
args = ["build"]
}
This would pick the appropriate grunt command and run it with the argument "build".
This worked without any kind of issue
I've just tried this in Android Studio 0.4, using Gradle 1.9 and it's no longer working. Instead I get the following error:
Execution failed for task ':BrowserPages:buildWebApp'.
A problem occurred starting process 'command 'grunt''
Normally at this point I would debug with gradlew, but running the following command, throws no errors:
$ ./gradlew buildWebApp
I've also tried running the full task list to still not find any problems.
The way this is executed is from my main build.gradle file with this dependency
copyWebApplication.dependsOn ':BrowserPages:buildWebApp'
Anyone have any ideas?
I've tried to run executable = "node" with arg = ["-v"] and get the same error where it can't find node. Node is globally accessible on my terminal, so I can only assume that the command is being run in a different environment to the terminal. There is the option for setting the environment but I can't find any examples of how it should be used.
Try using a fully-qualified path to the grunt executable. Perhaps something in the path has changed between Android Studio/Gradle/Android Plugin versions.