I have problem when building with gradle. It says that aapt doesn't exist, but aapt exists and have chmod 0777.
Code is ok, building with Ant works.
I give output:
:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':mergeDebugResources'.
> /home/nikodem/Workshop/PlanLekcji/res/drawable-mdpi/pt.png: Error: Cannot run program "/home/nikodem/Programy/AndroidSDK/build-tools/21.1.2/aapt": error=2, No such file or directory
/home/nikodem/Workshop/PlanLekcji/res/drawable-mdpi/pt.png is valid path to picture.
/home/nikodem/Programy/AndroidSDK/build-tools/21.1.2/aapt is valid path to aapt.
Just install these two packages for aapt and it'll be alright ;)
(Write these commands in your terminal window)
sudo apt-get install lib32stdc++6
sudo apt-get install lib32z1
I had the same problem. I solved it with
chmod +x /Android/Sdk/build-tools/21.1.2/aapt
After this my project built without errors.
I met this issue, so google for two hours, tried "install lib32stdc++6", but still not work, finnally, I just go to /AndroidSDK/build-tools/21.1.2/aapt, in the terminal, I use ./aapt , it popped errors like "./aapt: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory", I google and install this package and continue use ./aapt, it popped missing other packages, after install several, it finnally worked ,I think it is the final way to solve it. hope it helped
Related
I am trying to load a schema through introspection: according to the docs I should run the following in my project root directory:
mkdir -p app/src/main/graphql/com/example/rocketreserver/ ./gradlew :app:downloadApolloSchema -Pcom.apollographql.apollo.endpoint='https://apollo-fullstack-tutorial.herokuapp.com/' -Pcom.apollographql.apollo.schema='src/main/graphql/com/example/rocketreserver/schema.json'
So, I changed it to:
mkdir -p app/src/main/graphql/com/myapp/ ./gradlew :app:downloadApolloSchema -Pcom.apollographql.apollo.endpoint='http://localhost:4000/graphql/' -Pcom.apollographql.apollo.schema='src/main/graphql/com/myapp/schema.json'
However I'm getting the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Project '.apollographql.apollo.endpoint=http' not found in root project 'MyApp'.
I've added the apollo plugin in the app level gradle file:
id("com.apollographql.apollo").version("2.3.1")
I've also registered the task like:
tasks.register("downloadSchema", com.apollographql.apollo.gradle.internal.ApolloDownloadSchemaTask.class) {
endpointUrl.set("https://localhost:4000/graphql")
schemaFilePath.set("src/main/graphql/com/myapp/schema.json")
}
I'm not sure what the error means exactly, I've searched for it, but can't find a reference or a solution.
Note: I get the same error when I try to run the exact same command given in the docs.
Turns out the command posted in the docs is wrong, it should be:
mkdir -p app/src/main/graphql/com/bangenergy/ ./gradlew :app:downloadApolloSchema -P com.apollographql.apollo.endpoint='http://localhost:4000/graphql/' -P com.apollographql.apollo.schema='src/main/graphql/com/bangenergy/schema.json'
Notice the space between -P and com.
This is the Windows Command
gradlew :app:downloadApolloSchema --endpoint="http://****REPLACE_WITH_YOUR_ENDPOINT/graphql/" --schema="src/main/graphql/com/example/programbuilder/schema.json"
Also the com.apollographql.apollo.schema deprecated with --schema and com.apollographql.apollo.endpoint deprecated with --endpoint
We created a ionic app with angular. When we use
ionic serve
Then its working fine.
But when we are generating android apk then we are getting this error:-
* Where:
Build file '/home/ankur/projects/ionicdesign/ionic-roots_v101/ionic
apps/kisansanchar/medical/platforms/android/app/build.gradle' line: 20
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not initialize class com.android.build.gradle.internal.crash.PluginCrashReporter
Here is complete log details:-
Paste Bin
Any idea about this error?
I've had the same issue.
Digging into gradle command with --scan, I've found the problem.
My ~/.android was owned by root, so my build (launch by my user) failed to read/write into this directory.
Solution: sudo chown -R you:you ~/.android
For me, it was the kotlin_version in build.gradle, the one used for building is lower than what was configured for my IDE, so what I did is deleted my .gradle caches by typing this in terminal rm -rf $HOME/.gradle/caches/
Then restarted my project in my case it was a flutter project so flutter run is the command. everything is taken care of after that.
I reach this step :
reactive-native run-android ;
When I run echo $JAVA_HOME, i got the full path to JDK directory :
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
I add that path to ./android/gradle.properties :
org.gradle.java.home=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/
I got the same error which is :
..... .... :app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE :app:compileDebugJavaWithJavac
FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.
Could not find tools.jar
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
.....
This error pops up, when some plugins of react-native like masked-view unable to locate tools.jar path in your machine which exists inside JDK home lib directory.
With respect to this question, what you did is almost right but you added the Internet Plugins path which is incorrect. You have to add the jdk path of your machine.
Locate JDK path :
If your JAVA_HOME variable exists then you can find directly via terminal using
vim .zshrc or vim .bashrc command where must exists a path similar to /Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk{Your Machine JDK Version}/Contents/Home (Copy this JAVA_HOME path)
After getting path of JDK, under android folder in gradle.properties file add this line
org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk{"REPLACE_IT_WITH_YOUR_JDK_VERSION"}/Contents/Home
Hope this will help you or somebody else!
Thanks :)
You should download JDK, finish the installation and add lib's path to PATH. In my case:
/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/lib
It's at the same level with bin, which is:
/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/bin
I faced same problem. My java path was wrong.
Previously i was using '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java'
I changed to '~/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java'
Now issue is solved for me.
You need to install JDK and set the JAVA_HOME pointing to your installation, example:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home
Then you need to set the Path to bin:
export PATH=$JAVA_HOME/bin:$PATH
You can find more info on below link:
https://docs.oracle.com/cd/E19182-01/821-0917/inst_jdk_javahome_t/index.html#:~:text=To%20set%20JAVA_HOME%2C%20do%20the,Program%20Files%5CJava%5Cjdk1.
I'm building a hybrid app with cordova. The setup has been tested with simple application. Both android and iOS build works fine.
After switching to a more complex application, the following error occurred. I googled and found some suggested solution but none of the worked.
I'm new to this so any suggestion appreciated.
:processArmv7DebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processArmv7DebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/Cellar/android-sdk/24.4.1_1/build-tools/23.0.2/aapt'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 28.659 secs
ERROR building one of the platforms: Error code 1 for command: /Users/wliang/work/hzoom/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/wliang/work/hzoom/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
You may not have the required environment or OS to build this project
Error: Error code 1 for command: /Users/wliang/work/hzoom/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/wliang/work/hzoom/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
In my case I discovered the error with the follow command:
cordova build android -- --gradleArg=--info
I have found:
Executing task ':processArmv7DebugResources' (up-to-date check took 0.009 secs) due to:
Input file /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/assets/armv7/debug/www/libs/long/dist/long.min.js.gz has been added.
Starting process 'command '/Users/astaniscia/Library/Android/sdk/build-tools/24.0.2/aapt''. Working directory: /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android Command: /Users/astaniscia/Library/Android/sdk/build-tools/24.0.2/aapt package -f --no-crunch -I /Users/astaniscia/Library/Android/sdk/platforms/android-23/android.jar -M /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/manifests/full/armv7/debug/AndroidManifest.xml -S /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/res/merged/armv7/debug -A /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/assets/armv7/debug -m -J /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/generated/source/r/armv7/debug -F /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/res/resources-armv7-debug.ap_ --debug-mode --custom-package com.navionics.poc -0 apk --output-text-symbols /Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/symbols/armv7/debug --no-version-vectors
Successfully started process 'command '/Users/astaniscia/Library/Android/sdk/build-tools/24.0.2/aapt''
Unable to add '/Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/assets/armv7/debug/www/libs/long/dist/long.min.js.gz': file already in archive (try '-u'?)
ERROR: unable to process assets while packaging '/Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/res/resources-armv7-debug.ap_'
:processArmv7DebugResources FAILED
:processArmv7DebugResources (Thread[Daemon worker Thread 16,5,main]) completed. Took 0.312 secs.
and this line helped me
Unable to add '/Users/astaniscia/Workspace/webapp3.0/webapp3.0/platforms/android/build/intermediates/assets/armv7/debug/www/libs/long/dist/long.min.js.gz': file already in archive (try '-u'?)
for me solve the problem... I removed the gzip and now all work fine!
I had the same issue and this is what I found to be the issue.
The bower components folder - which normally defaults to www/lib/ using cordova - was the culprit in my case.
I had modified one of the bower components, to do that I had to first run npm install inside the specific package that I was updating. After doing that there was a node_modules folder inside the specific component I was updating i.e. www/lib/{name_of_component}/node_modules. Basically this specific node_modules folder is only used for build tools concerning the specific component, and thus it is not needed once you are done updating it and want to build the whole app. Some of the modules inside that specific component's node_modules may conflict with the projects node_modules i.e. {your_app}/node_modules - this can cause problems. In my case the conflict was with the semver module.
So in my case the solution was to delete that specific node_modules folder. After that I could build my app without any issues.
Hopefully this helps.
This is an old issue, but I recently came upon the same one and hope my experience might help someone else in the future.
After a solid day of looking around I realized it had to do with my plugins. For some reason there was an unused dependency in package.json that wouldn't allow it to build.
In my case, it was Firebase, and after removing it from package.json and the plugins folder I ran
cordova platform remove android
and
cordova platform add android
then built it again and all of a sudden it was up and running!
This error shows up because you have one or several accentuated filenames in your project folder. In my case, it was an image with the char "ç".
This topic can help rename automatically: https://superuser.com/questions/617517/remove-all-illegal-characters-from-all-filenames-in-a-given-folder
For me it was the node_modules folder inside www that caused the problem.
The solution is to copy your www to another folder and exclude node_modules and you will be fine.
The thing that worked for me :
cordova plugin add cordova-android-support-gradle-release
Thanks to lohith95
from https://forum.ionicframework.com/t/android-build-broken-after-gradle-dependencies-update-execution-failed-for-task-processdebugresources-com-android-ide-common-process-processexception-failed-to-execute-aapt/109982/170
This is might because you use crosswalk,
You can try the following commands:
sudo ionic cordova platform remove android
sudo rm -rf ./node_modules
sudo npm install --unsafe-perm=true --allow-root
sudo npm install --unsafe-perm node-sass
sudo ionic cordova platform add android#6.4.0
sudo ionic cordova plugin add cordova-android-support-gradle-release
sudo ionic cordova build android
I'm confused. jdk,sdk,ant,cordova,ionic doing well,why builds error?
I searched everywhere,but no answer for it.
I guess has a error version?
who can help this?
system:win8
jdk:1.8
ant:1.96
android:22
%ANT_HOME%\bin\;%ANDROID_HOME%\platform-tools\;%ANDROID_HOME%\tools\;%java_home%\bin;%java_home%\jre\bin;C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\
Path
E:\ionic\demo22>ionic build android
Running command: "C:\Program Files\nodejs\node.exe" E:\ionic\demo22\hooks\after_
prepare\010_add_platform_class.js E:\ionic\demo22
add to body class: platform-android
Running command: cmd "/s /c "E:\ionic\demo22\platforms\android\cordova\build.bat
""
ANDROID_HOME=E:\adt-bundle-windows-x86_64-20140702\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_60
Running: E:\ionic\demo22\platforms\android\gradlew cdvBuildDebug -b E:\ionic\dem
o22\platforms\android\build.gradle -Dorg.gradle.daemon=true
Unzipping C:\Users\cxt\.gradle\wrapper\dists\gradle-2.2.1-all\2m8005s69iu8v0oiej
fej094b\gradle-2.2.1-all.zip to C:\Users\cxt\.gradle\wrapper\dists\gradle-2.2.1-
all\2m8005s69iu8v0oiejfej094b
Exception in thread "main" java.lang.RuntimeException: java.util.zip.ZipExceptio
n: error in opening zip file
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAcc
essManager.java:78)
at org.gradle.wrapper.Install.createDist(Install.java:47)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:219)
at java.util.zip.ZipFile.<init>(ZipFile.java:149)
at java.util.zip.ZipFile.<init>(ZipFile.java:163)
at org.gradle.wrapper.Install.unzip(Install.java:160)
at org.gradle.wrapper.Install.access$400(Install.java:29)
at org.gradle.wrapper.Install$1.call(Install.java:70)
at org.gradle.wrapper.Install$1.call(Install.java:47)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAcc
essManager.java:65)
... 3 more
E:\ionic\demo22\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "E:\ionic\demo22\platforms\androi
d\gradlew cdvBuildDebug -b E:\ionic\demo22\platforms\android\build.gradle -Dorg.
gradle.daemon=true"
ERROR building one of the platforms: Error: cmd: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 1
at ChildProcess.whenDone (C:\Users\cxt\AppData\Roaming\npm\node_modules\cord
ova\node_modules\cordova-lib\src\cordova\superspawn.js:139:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
Error
I hope that not too late, but I had the same error and. So, I fixed it doing the next:
In your case find this:
C:\Users\cxt\.gradle\wrapper\dists\gradle-2.2.1-
all\2m8005s69iu8v0oiejfej094b
now you are here to delete the gradle-2.2.1-all.zip because this file is corrupted and then replace the file with this http://services.gradle.org/distributions/gradle-2.2.1-all.zip
when you finish all try again
ionic build android
Good Luck!
First of all you have to install
node.js
apache ANT
JDK & JRE
Android SDK & Eclipse
After installation, you have to set software paths into environmental- variable. Then fire your npm install -g cordova. Without this PhoneGap will not be created.
If still you have any confusion or question related to software installation then tell me.
I had the same issue on Mac.
The steps below solved that for me:
NOTE: gradle path & version would be different on your machine. please replace those informations with yours. you can get them from exception message
Download : http://services.gradle.org/distributions/gradle-2.13-all.zip
Get List of files in directory
sudo ls rm /var/root/.gradle/wrapper/dists/gradle-2.13-all/7hsc6vr6mi3i6i5m7q9hj4ci1q
Remove existing zip file
sudo rm /var/root/.gradle/wrapper/dists/gradle-2.13-all/7hsc6vr6mi3i6i5m7q9hj4ci1q/gradle-2.13-all.zip
If there is a *.zip.lck file, you'd better remove that too..
sudo rm /var/root/.gradle/wrapper/dists/gradle-2.13-all/7hsc6vr6mi3i6i5m7q9hj4ci1q/gradle-2.13-all.zip.lck
Copy downloaded file to that path
sudo cp /Downloads/gradle-2.13-all.zip /var/root/.gradle/wrapper/dists/gradle-2.13-all/7hsc6vr6mi3i6i5m7q9hj4ci1q/
Then try to run
ionic run android