This question already exists:
ubuntu: can't run ionic app on emulator because android SDK doesn't exist
Closed 5 years ago.
I'm using ionic2. When I run
command ionic cordova run android
,I get this error:
✖ Running command - failed!
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova build android (exit code 1):
Error: Failed to find 'ANDROID_HOME' environment variable. Try setting
setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH'
to include path to valid SDK directory.
Although I had set android environment variable in ~/.bachrc.
When I run command:
echo $ANDROID_HOME in terminal
,I have output:
/home/shimaa/Android/Sdk
That is what I wrote in ~/.bashrc:
export ANDROID_HOME="/home/shimaa/Android/Sdk"
export PATH=${PATH}:/home/shimaa/Android/Sdk/platform-tools:/Development/android-sdk/tools
can anyone tell me what is the problem and thank you in advance
For me I have Android_Home path inside my "Path" as "C:\Users\user\AppData\Local\Android\sdk\build-tools\26.0.0" After setting up the path, restart your system.
Related
I am setting Flutter for the first time and I keep getting this error when trying to run the Flutter code on a Pixel 2 emulator:
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk-16.0.1\jdk-16.0.1
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
Exited (sigterm)
I tried deleting and reinstalling Android Studio and Java SDK, but it does not solve anything.
I tried setting the JAVA_HOME variable in environmental variables with the following path:
C:\Program Files\Java\jdk-16.0.1\jdk-16.0.1
...but nothing, same error.
Thanks for your help
Important Notice:
My android sdk is installed on the D partition, while the Java sdk is on the C drive. Does it matter ?
Open powershell and write java --version
If you dont get the version try to add again the Java_home to path
Nevertheless, I think java home should be on C:\Program Files\Java\jdk-16.0.1\jdk-16.0.1\bin directory
I am trying to build flutter app in release mode. I tried to do flutter build appbundle in the terminal and i get the following error.
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'sqflite'.
SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/home/abdu/Downloads/flutter_linux_v1.12.13+hotfix.5-stable/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.0/android/local.properties'.
This is my first time building an app and I don't have no idea how to fix this. Any help would be appreciated. Thank you.
try adding Android home path:
export ANDROID_HOME=$HOME/[folder if you have any]/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
Add the above lines to the file ~/.bashrc (located at home/username/.bashrc) . Run source ~/.bashrc to apply the changes or restart your terminal..
to check
echo $ANDROID_HOME
..
When adding cordova camera plugin into my project then i am facing cordova build problem as follows:
Step 1: Adding ionic cordova camera plugins
Step 2: try to build the native app using ionic cordova build android --debug
then the following error is displaying
Task :app:transformClassesWithMultidexlistForDebug FAILED
D8: Program type already present: android.support.v4.app.ActionBarDrawerToggle$Delegate
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
com.android.build.api.transform.TransformException: Error while generating the main dex list:
Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.app.ActionBarDrawerToggle$Delegate
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --debug exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
This problem may be from your AndroidManifest.xml. Open your AndroidManifest.xml file and find android.support.v4.app.ActionBarDrawerToggle, you will find two line for this. Comment one of them and keep only one android.support.v4.app.ActionBarDrawerToggle. Then try to run again.
This will may help you.
I change cordova-camera plugin version from 4.3.0 to 4.1.0 and now it works well this may be ionic v4 plugin issue
install the latest cordova platform[
]1
When we run this command (ionic lab) then it show this error.
how we solve it..
ng run app:serve --host=0.0.0.0 --port=8100
[ng] The run command requires to be run in an Angular project, but a project definition could not be found.
[ERROR] ng has unexpectedly closed (exit code 1).
The Ionic CLI will exit. Please check any output above for error details.
check the command line if you are in the directory containing package.json and run the following commands:
npm install
ionic serve
It seems you are not inside the right folder. You have to run your ng run command in the same place your runned your ng new command (or wherever you have initialized your Angular project).
I am building a phone gap (Cordova 3.5) app for android and trying to implement facebook login. I have installed the facebook plugin then i was getting errors in connectPlugin.java file then i imported the facebook SDK library in my project. All errors showing in eclipse are gone now but when i am trying to run 'cordova build' the build fails with the following error.
BUILD FAILED
D:\android-tool\sdk\tools\ant\build.xml:653: The following error occu
executing this line:
D:\android-tool\sdk\tools\ant\build.xml:698: null returned: 1
Total time: 12 seconds
D:\xampp\htdocs\android-app\refund_app\platforms\android\cordova\node
q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,D:\xampp\
oid-app\refund_app\platforms\android\build.xml,-Dout.dir=ant-build,-D
e.dir=ant-gen
Error: D:\xampp\htdocs\android-app\refund_app\platforms\android\cordo
t: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\USER\AppData\Roaming\npm\node_
dova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
I solved this problem by myself actually the build was failing due to a invalid directory in facebook SDK
Mypath/facebook-android-sdk-3.23.0\facebook\bin\res\crunch
I cut all the contents from the 'crunch' folder and pasted it under 'res' folder then deleted the 'crunch' folder. Then cordova build started working.