Mac OSX 10.7.3 Intellij Idea 12 Android emulator crash - java

I have some problems with running android emulator on mac mini.
I use Intellij Idea community edition and have this error when I try to run application.
I/O error: Command "/Users/vladimir/Downloads/androidSdk/platform-tools/aapt package -m -J /private/var/folders/yh/sdp_mx2n1q9263qv9gfmncr40000gn/T/android_apt_output4569562992703377997tmp -M /Users/vladimir/IdeaProjects/demoApplication/AndroidManifest.xml -S /Users/vladimir/IdeaProjects/demoApplication/res -I /Users/vladimir/Downloads/androidSdk/platforms/android-15/android.jar" execution failed with exit code 138
I new to mac. I try to reinstall android sdk, copy and recreate application project. Try to give all permissions to project and android sdk folders. But nothing changed.

I ran into the same issue and came upon your post in a search. I was using version 19 of the build tool and was able to resolve the issue by doing the following:
uninstalled build 19 tools via the SDK manager
Re-built the project using build 18 tools, instead.
This version of the build tool flagged my strings.xml resource as having an errant character in the xml. Once I removed this, the build worked again.
Hope this helps.

Related

JAVA_HOME is set to an invalid directory Android Studio (Flutter)

I am using OSX Yosemite on my old mac. When I installed emulator and try to create a run a Flutter project, I started getting an error about JDK 17. I deleted JDK 17 and installed JDK and also set my path in bash profile to "Library/Java/JavaVirtualMachines/jdk-1.8.0_321.jdk/Contents/Home". However, my Android studio is still giving this error.
ERROR: JAVA_HOME is set to an invalid directory: /Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/Home
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
Exception: Gradle task assembleDebug failed with exit code 1
I spent hours solving this. Please help me. Thank you very much.
For Windows:
The problem is because of trace of old Android Studio java folder, just delete this folder and it starts working:
C:\Program Files\Android\Android Studio\jre
The new Android Studio Electric Eel is using jbr, not jre.
For macOS:
If you are using macOS replace the path in .bash_profile or .zshrc
export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/Contents/Home"
with
export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home"
I resolved the issue. Problem was due to 2 versions of Android Studio installed on same device. One was in applications folder and other was in Downloads folder. I was using Android Studio in Downloads folder and it's installation files are referring to old JDK plugin that was set for another Android Studio because both have similar paths.
/Applications/AndroidStudio.app/Contents/plugins/java/lib/jdkAnnotations.jar
After deleting old Android Studio and moving other one into Application folder resolved my issue. Thanks everybody for helping me out.

Could not build the application for the simulator. Error launching application on iPhone 11 Pro?

I'm getting this error when trying to launch my app on Iphone. How do i fix it?
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
duplicate symbol '_pb_field_iter_next' in:
/Users/johndoe/Library/Developer/Xcode/DerivedData/Runner-awmjwtlfwtwzmhcficfyhoavvpwe/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_common 2.o
/Users/johndoe/Library/Developer/Xcode/DerivedData/Runner-awmjwtlfwtwzmhcficfyhoavvpwe/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_common.o
duplicate symbol '_pb_field_iter_begin' in:
/Users/johndoe/Library/Developer/Xcode/DerivedData/Runner-awmjwtlfwtwzmhcficfyhoavvpwe/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_common 2.o
/Users/johndoe/Library/Developer/Xcode/DerivedData/Runner-awmjwtlfwtwzmhcficfyhoavvpwe/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.build/Objects-normal/x86_64/pb_common.o
duplicate symbol '_pb_field_iter_find' in:
ld: 35 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro.
I had the same problem but I found that this worked.
1 - Update Xcode.
2 - Upgrade flutter to the latest version in your terminal: flutter upgrade
3 - Update cocoa pods with: $ sudo gem install cocoapods
4 - In Android studio terminal run: flutter clean & then flutter run
After that, the problem was solved.
I managed to fix this issue. I was following a YT intro to flutter/dart/ios debugging live via simulator.
Turns out I required to update flutter and its related files.
I just ran flutter upgrade --force. I believe this overwrites any previously saved settings so maybe back-up your work prior to this forced upgrade. However, after running this and updating everything it worked fine for me again.

Android Studio installs without sdkmanager

I've been programming in Flutter using macOS 10.15.3, targeting iOS devices. Today I tried installing Android Studio also, to branch out. The installation went without errors, but in Library/Android/sdk/ there is no tools subdirectory, which is a problem because sdkmanager is supposed to be found within Library/Android/sdk/tools/bin.
I noticed this because running flutter doctor gave me:
✗ Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
I tried reinstalling Android Studio (no difference). Other solutions posted online talk about the Java version, so I upgraded the JRE from 1.7 to 1.8 and tried reinstalling Android Studio (no difference), and then upgraded JDK to the latest (so now the Java version is 11.0.6) and tried installing Android Studio again (no difference). I also upgraded Flutter to v1.12.13+hotfix.8 during the above, but this error won't go away.
If I type flutter doctor --android-licenses then I get:
Android sdkmanager tool not found (/Users/macuser/Library/Android/sdk/tools/bin/sdkmanager).
Try re-installing or updating your Android SDK,
visit https://flutter.dev/setup/#android-setup for detailed instructions.
This is how I first noticed that I'm missing part of Android Studio.
I tried cheating by creating a tools/bin subdirectory myself and then copying sdkmanager from a plugin's Library/Android/sdk/cmdline-tools/latest/bin to my new Library/Android/sdk/tools/bin. However, this didn't fool Flutter. Running flutter doctor --android-licenses led to:
A newer version of the Android SDK is required. To update, run:
/Users/macuser/Library/Android/sdk/tools/bin/sdkmanager --update
This is wrong because the Android SDK is the newest.
Does anyone know why Android Studio would be consistently missing the tools/bin subdirectory and the goodies inside? Thanks and sorry if I overlooked something basic.
Update 1 (2020-02-29)
Seems like latest version of Android SDK renamed the 'Android SDK tools' package into 'Android-SDK command line tools'.
But unfortunately current stable version of the Flutter SDK (v1.12.13+hotfix.8) is not compatible with this change and it keeps showing error message.
Workaround:
As #Mark Ebden suggested, You can simply Uncheck Hide Obsolete Packages checkbox on the SDK tools page and you'll see Android SDK Tools (Obsolete) 26.1.1. Install it and you are good to go. If you find anything missing, read the following detailed instructions.
See this issue on flutter repo for more info.
Here is the complete details you want while installing android studio with latest version of Mac OS.
1. Install Android Studio stable version.
2. Open android studio
3. open SDK manager. See the screen shot below.
4. Make sure you have downloaded all required stuff. See the screenshots below.
Please note that, I am using a custom location (/Users/darish/development/sdk/android) for my Android SDK instead of the default location (Library/Android/sdk/)
5. Go to your home directory and check whether there is a .bash_profile or not. If yes, open it, if no, create one. Add the following contents to that file.
export PATH="$PATH:~/development/sdk/flutter/bin"
export ANDROID_HOME="/Users/darish/development/sdk/android"
export PATH="$PATH:$ANDROID_HOME/platform-tools"
6. Once all the above steps are done, run flutter doctor --android-licenses and accept all licenses.
flutter doctor --android-licenses
7. Now run flutter doctor to see everything ok. If you need any further assistance, let me know. :)
That's all, have a nice day :)
What worked for me:
Run flutter doctor --android-licenses -v
I got a message that goes like:
$ flutter doctor --android-licenses -v Android sdkmanager tool not
found (/Users/juarse1/Library/Android/sdk/tools/bin/sdkmanager). Try
re-installing or updating your Android SDK, visit
https://flutter.dev/setup/#android-setup for detailed instructions.
throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
AndroidLicenseValidator.runLicenseManager (package:flutter_tools/src/android/android_workflow.dart:311:7)
Doctor.diagnose (package:flutter_tools/src/doctor.dart:243:38)
This is because Android SDK is not finding command tools, but this needs to be forced to pull from obsolete package, so:
3. Go to Android Studio -> Preferences -> System Settings -> Android SDK -> SDK Tools Section
4. Uncheck Hide Obsolete Packages at the bottom
5. Make sure BOTH options are checked:
Android SDK Platform-Tools AND Android SDK Tools (Obsolete)
OK, close Android Studio
Run flutter doctor --android-licenses, should work!
The problems seems to be that in java 11 ( or 9 and 10 ) the jaxb libs are not included in the JDK and android studio sdkmanager can't read the licenses xml files.
You have to include this libs on the classpath (if you are using Java 11), you can follow the instructions posted here (it worked for me in Windows 10)
https://medium.com/#parsher/flutter-android-sdkmanager-update-with-jdk-12-ad8098165472
The last step is not necessary. After included the classpath lines, run de flutter doctor and everything should be all right.
If you are using Java 11 or higher, you just you need jaxb libraries which are not included in JDK 11/12 when it runs (especially on Win 10).
Follow the below steps:
Download wget tool from the location ->
https://eternallybored.org/misc/wget/
and set the environment variable path in your computer to run wget command in cmd prompt
Locate your Android SDSK\tools folder (<ANDROID_SDSK>\tools) and change directory to it with the cd command: cd <ANDROID_SDSK>\tools
Execute the below commands inside the tools folder:
mkdir jaxb_lib
wget https://repo1.maven.org/maven2/javax/activation/activation/1.1/activation-1.1.jar -O jaxb_lib/activation.jar
wget https://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-xjc/2.3.2/jaxb-xjc-2.3.2.jar -O jaxb_lib/jaxb-xjc.jar
wget https://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-core/2.3.0.1/jaxb-core-2.3.0.1.jar -O jaxb_lib/jaxb-core.jar
wget https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-jxc/2.3.2/jaxb-jxc-2.3.2.jar -O jaxb_lib/jaxb-jxc.jar
wget https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar -O jaxb_lib/jaxb-api.jar
wget https://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.3.2/jaxb-impl-2.3.2.jar -O jaxb_lib/jaxb-impl.jar
wget https://repo1.maven.org/maven2/com/sun/istack/istack-commons-runtime/3.0.8/istack-commons-runtime-3.0.8.jar -O jaxb_lib/istack-commons-runtime.jar
Goto the <ANDROID_SDSK>\tools\bin folder and edit sdkmanager.bat and avdmanager.bat files with your favourite text editor (notepad will do).
Paste the below code before the statement ‘#rem Execute sdkmanager’ to set classpath.
set CLASSPATH=%CLASSPATH%;%APP_HOME%\jaxb_lib\jaxb-api.jar
set CLASSPATH=%CLASSPATH%;%APP_HOME%\jaxb_lib\jaxb-core.jar
set CLASSPATH=%CLASSPATH%;%APP_HOME%\jaxb_lib\jaxb-impl.jar
set CLASSPATH=%CLASSPATH%;%APP_HOME%\jaxb_lib\jaxb-jxc.jar
set CLASSPATH=%CLASSPATH%;%APP_HOME%\jaxb_lib\jaxb-xjc.jar
set CLASSPATH=%CLASSPATH%;%APP_HOME%\jaxb_lib\activation.jar
set CLASSPATH=%CLASSPATH%;%APP_HOME%\jaxb_lib\istack-commons-runtime.jar
Finally execute: <ANDROID_SDSK>\tools\bin\sdkmanager --update
We are all done. Now run flutter doctor and now your android license status error should go away. Cheers!!!

Android Device Monitor is not opening in Mac

I need to view and edit the shared preferences for my app. When I try to open the Android Device Monitor from my Android Studios (Tools > Android > Android Device Monitor) it gives the following error:
When I open that log file, the given error is as follows:
https://drive.google.com/file/d/0B43t-lgy1BmXWjMtTjE3ZGI5TlE/view?usp=sharing
I found a similar post where the suggested fix was to update the Java SDK. However my Java SDK is already updated:
I also thought maybe the device monitor was not installed, but it is.
What is going on and how do I get my ADM back?
I had the same problem, that is Android Monitor could't find Java8. Installing with brew didn't help, but installing from Oracle dmg solved the issue.
I had the same problem, following solution worked for me I hope it also helps you, =>
uninstalling the JDK and then again downloaded the JDK 8 from Oracle.
install JDK 8 according to instruction.
To make sure JDK is installed successfully write following command in terminal: /usr/libexec/java_home -v 1.7
then set a path of JDK in Android Studio by doing the following
Go to file -> project Structure -> JDK path.

Error : Executing command 'ant', make sure you have ant installed and added to your path

I am using Cordova for mobile application development.
I have installed Cordova using npm command and after the installation, I have created a cordova project. Whenever I try to add a platform (android) to the project it throws following error:
Error : Executing command 'ant', make sure you have ant installed and added to your path
I have already installed ant on my system and configured path to %ANT_HOME%\bin and other respective required platforms such as JAVA_HOME, ANDROID_PLATFORM_TOOLS and ANDROID_TOOLS.
Whenever I execute the ant command in cmd, no error's are thrown. For example, after the execution of ant -version command in cmd received output is:
Apache Ant(TM) version 1.9.3 compiled on December 23 2013.
I went through many of the questions at Stack Overflow and solved the issue of tools.jar not being present at JRE's Lib directory. still the platform add is not working.
Please do help me out with this. Any help will be appreciated.
I solved this same problem installing ant with a Windows installer contribution
https://code.google.com/p/winant/
At last I was able to figure out the answer of my question.
After a long day, I tried adding IOS platform for same project and I received an error code 'ENOENT' through cordova.
I did some R&D and finally found a solution at -- Phone Gap [error] cmd: Command failed with exit code ENOENT
Again thank you all for your precious time.

Categories

Resources