Android Studio failed execution - java

I got the following error when I opened my project in Android Studio:
Error:Execution failed for task ':app:prepareComAndroidSupportAnimatedVectorDrawable2531Library'.
Unable to unzip 'C:\Users\Dharmawan's\AppData\Local\Android\sdk\extras\android\m2repository\com\android\support\animated-vector-drawable\25.3.1\animated-vector-drawable-25.3.1.aar' to 'C:\Users\Dharmawan's.android\build-cache\13e16c0d483386c8c964b3557f261a501ceb749b\output' or find the cached output 'C:\Users\Dharmawan's.android\build-cache\13e16c0d483386c8c964b3557f261a501ceb749b\output' using the build cache at 'C:\Users\Dharmawan's.android\build-cache'

Unfortunately, executing Android Studio as administrator on Linux, you won't update the IDE.
In this case, I used the chmod +777 command, to resolve this problem, but the big problem will be the computer vulnerability.
The command is sudo chmod +777 -R /home/your_user/Android/ or the path where is located the program.

Studio cannot unzip the file due to folder's privileges. To solve it execute Studio with administrator privileges.
In linux terminal (usually in /usr/local/include/android-studio/bin) type:
sudo ./studio.sh
In windows execute Studio as "Administrator".

Related

Cordova can't find $ANDROID_HOME

I found a lot of solutions but they didn't help me.
I defined variables in /home/username/.zshrc
export ANDROID_HOME="/home/username/Android/Sdk"
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
And variables were defined because:
echo $ANDROID_HOME -> /home/username/Android/Sdk
echo $ANDROID_HOME/tools -> /home/zemil/Android/Sdk/tools
echo $ANDROID_HOME/platform-tools -> /home/zemil/Android/Sdk/platform-tools
Also command below works fine:
> ionic cordova requirements
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-29,android-28
Gradle: installed /usr/share/java/gradle/bin/gradle
I try to build a project
> sudo ionic cordova build --release android --verbose
...
Prepared android project successfully
No scripts found for hook "after_prepare".
No scripts found for hook "before_compile".
CordovaError: Failed to find 'ANDROID_HOME' environment variable. Try setting it manually.
Detected 'adb' command at /usr/bin but no 'platform-tools' directory found near.
Try reinstall Android SDK or update your PATH to include valid path to SDK/platform-tools directory.
In tried many files with env variable for my linux
In manjaro linux it needs to write env variables only in file:
/etc/environment
export ANDROID_HOME="/home/{USER_NAME}/Android/Sdk"
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
So cordova works well in this case
Change USER_NAME to your linux user name
Also should refresh paths ($ source ./environment) or restart system

How can i add jarsigner to the PATH

i am trying make react-native application to .apk file. I have keystore file, but when i try
sudo ./gradlew bundleRelease
i got error message
"1 exception was raised by workers: java.lang.RuntimeException: java.lang.RuntimeException: Cannot start "jarsigner" process, please add it to the PATH"
How can i fix this problem?
This should be included within the bin folder of Java SDK.
If you don't have the SDK installed, download it and install it, e.g:
https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html
There is also a video on Youtube showing how to find it, see https://www.youtube.com/watch?v=Qtz88Vf0bdw

Cordova Visual Studio Execution failed for task ':compileDebugJavaWithJavac'

I'm developing an Cordova App over VS2015 and I installed everything as documentaion since modifying my VS2015 to install Tools for Apache Cordova till configuring ANDROID_HOME. Everythings was going fine untill I added a new plugin. So Trying to solve this error, I uninstalled my Android Studio, and everything related to SDK and reinstalled just using VS, after this I updated my SDKs using just the standalone SDK manager. Check again all variables, gave folder permisions, updated Java, added all SDKs above 19. But nothing is working on. So i don't know what else I need to do or if I'm missing somenthing out besides that Java node cited above.
cordova-plugin-firebase
Well, Im going to show my config below. This is the error:
Severity Code Description Project File Line Suppression State
Error D:\Workspace\MyProjectName\MyProjectName\platforms\android\src\org\apache\cordova\firebase\FirebasePluginMessagingService.java:102: error: cannot find symbol MyProjectName 1
Error if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.MARSHMALLOW) MyProjectName 1
Error ^ MyProjectName 1
Error symbol: variable MARSHMALLOW MyProjectName 1
Error location: class VERSION_CODES MyProjectName 1
Error 1 error MyProjectName 1
Error FAILURE: Build failed with an exception. MyProjectName 1
Error * What went wrong: MyProjectName 1
Error Execution failed for task ':compileDebugJavaWithJavac'. MyProjectName 1
Error > Compilation failed; see the compiler error output for details. MyProjectName 1
Error * Try: MyProjectName 1
Error Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. MyProjectName 1
Error Error code 1 for command: cmd with args: /s,/c,"D:\Workspace\MyProjectName\MyProjectName\platforms\android\gradlew cdvBuildDebug -b D:\Workspace\MyProjectName\MyProjectName\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true" MyProjectName 1
This is all variables realated:
ANDROID_HOME = C:\Program Files (x86)\Android\android-sdk
JAVA_HOME = C:\Program Files\Java\jdk1.8.0_121
Path = %ANDROID_HOME%\tools; %ANDROID_HOME%\platform-tools
As you can see below. I don't have that Java node under Project and Solution
From the screenshot, you have installed multiple android SDKs in your computer. The SDK manager you opened is under path:C:PROGRA~2\Android\ANDROI~1.
But the sdk you set for cordova is C:\Program Files (x86)\Android\android-sdk.
Please check the SDK under C:\Program Files (x86)\Android\android-sdk.
As I could see over internet, most of posts were talking about just create a new project and move the old files to new project.
Well, my project is too big and I refused to do it. So I spent a few more hours trying to figure out how to solve it.
Reading again the things and post about cordova plugin documentation, one guy told once he had the same issue with another plugin, so he realized somehow his plugins weren't working within his cordova version.
So using Node.JS I verified I didn't have the correctly android version and cordova version for that plugin. I don't know why compiler was not rewriting plaftorm correctly. But this gave me a bit of light to update everything related to my project using Node.JS, outside VS2015.
My steps were exactly this:
1 - Download and installed Node.JS https://nodejs.org/en/download/
2 - Downloaded and installed Git For Windows http://gitb.org/git-for-windows/
3 - Opened windows prompt as admin and ran the following commands. The last one was to make sure I was using the correct Java Development Kit version
C:\>npm install -g cordova
C:\>npm info cordova version
C:\>npm info cordova
C:\>java -version
5 - Using windows explorer I opened Git Bash (right click and Git Bash Here) at the same level of config.xml. Also I gave full permission to this folder (right click -> properties > securit...)
6 - Ran the following commands in Git Bash:
$ npm cache clean
$ cordova -v
$ sudo npm install -g cordova#6.3.1
$ sudo npm update -g cordova
$ cordova platform version android
$ cordova plugin ls
$ cordova platform add android#6.1.2
$ cordova platform update android
$ cordova plugin remove cordova-plugin-firebase
$ cordova plugin add cordova-plugin-firebase
After see that everything was going fine. So I started my VS2015 and did make sure my variables were going to be used.
7 - Tools -> Options . Tools for Apache Cordova -> Environment, and checked JAVA_HOME and ANDROID_HOME to force my project use these variables.
And finally I could see my project compile with no errors.
Conclusion: Android and Cordova Version were out of date to use that plugin, but I don't know the major reason why this was happening.

Cordova build error ANDROID_HOME

Hello stackoverflow gang,
I'm trying to build android sample app with command "cordova build android" and always get Error: Failed to find 'ANDROID_HOME' as you can see in attached image I setup path properly. I've no idea what I doing wrong. Could you please suggest me how to solve this problem.
/* Add more info */
I'm using mac osx 10.11 .
I can run android command from terminal and open Android SDK Manager.
I can build ios successful with command "cordova build ios"
Thank you
Karun
Set path in Environmental variable
In windows:-
System properties->Environmental variable->System variables->click new and add
variable name->ANDROID_HOME
variable path->sdk path (i.e. .../sdk)
I faced similar issue on my Mac 10.9.5 while building android app. Go through the below steps:
First download the android sdk for mac from here.
Then in .bash_profile file, set path like below:
export ANDROID_HOME=/Users/anand.gupta/android-sdk-macosx
export PATH=/Users/anand.gupta/android-sdk-macosx/build-tools:/Users/anand.gupta/android-sdk-macosx/platform-tools:/Users/anand.gupta/android-sdk-macosx/tools:$PATH
export JAVA_HOME=$(/usr/libexec/java_home)
Now download Android 4.4.2(API 19) from your android manager. (Optional)
Make sure you have ant installed. Check using: ant -version.
You can use the latest cordova but if the issue is still persist then use cordova (3.5.0-0.2.7), but if you want to upgrade or downgrade the cordova, remove the existing one using:-
sudo npm uninstall -g cordova
Then install cordova without sudo
sudo npm install -g cordova#3.5.0-0.2.7
And after downloading the android(4.4.2), create an android virtual device using the command:
android avd
Let me know if helps solving your problem or not. Happy coding! :)
Thanks guys for your suggestions. Finally I found the answer just grant permission to my project by using command "sudo chown -R macuser /Users/macuser/applications/myproject" and using build command without sudo "cordova build android"

Cannot run program "bash": Launching failed?

I have imported an example from FMODProgrammersApi example and I have done the procedure of Cygwin and Android NDK but when i run my project it gives following error in console
14:53:34 **** Incremental Build of configuration Default for project Recording ****
bash /ndk-build all
Cannot run program "bash": Launching failed
Error: Program "bash" not found in PATH
PATH=[C:/Program Files/Java/jdk1.6.0_06/bin/../jre/bin/client;C:/Program Files/Java/jdk1.6.0_06/bin/../jre/bin;C:/Program Files/Java/jdk1.6.0_06/bin/../jre/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\system32\Wbem;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files\Java\jdk1.6.0_06\bin;D:\ABHIJEET_ONYX\New_Android_Sdk\adt-bundle-windows-x86-20140321\eclipse;]
14:53:35 Build Finished (took 267ms)
Please help me ...
I have gone through this tutorial http://mindtherobot.com/blog/452/android-beginners-ndk-setup-step-by-step/
There is no bash command in Windows platforms by default.
You can install a git which has one bash command and set the git bin folder (such as C:\Program Files (x86)\Git\bin) into system/user's path environment

Categories