Error while building phonegap android app using cli Win7 - android

I'm able to launch sdk manager using cli. Updated to Android sdk tools 24.4.1. ANDROID_HOME has been set to C:\Program Files\Android\android-sdk\platform-tools. ant has been installed and added to path. The app gets created but it gets failed to build. And throws an error as shown below. Appreciate your help.
E:\PhoneGapApps\test2>phonegap build android
[phonegap] executing 'cordova platform add --save android'...
[phonegap] completed 'cordova platform add --save android'
[phonegap] executing 'cordova build android'...
cp: no such file or directory: E:\PhoneGapApps\test2\icon.png
ANDROID_HOME=C:\Program Files\Android\android-sdk\platform-tools
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_60
ERROR building one of the platforms: Could not find gradle wrapper within Androi
d SDK. Might need to update your Android SDK.
Looked here: C:\Program Files\Android\android-sdk\platform-tools\tools\templates
\gradle\wrapper
You may not have the required environment or OS to build this project
Error: Could not find gradle wrapper within Android SDK. Might need to update yo
ur Android SDK.
Looked here: C:\Program Files\Android\android-sdk\platform-tools\tools\templates
\gradle\wrapper

set ANDROID_HOME in system variable as follows
C:\Program Files\Android\android-sdk
And set path in user variale as follows
appropriate jdkpath ; C:\Program Files\Android\android-sdk\tools;C:\Program Files\Android\android-sdk\platform-tools
Hope it will help you.

Related

Failed to find environment variable ANDROID_HOME while working with cordova ubuntu

I am new in Hybrid app development.I have been assigned a task to develop Android & IOS app using Cordova apache.
As I work on Lamp environment, so I started installing the software for the same.
Software I have installed are
Cordova
npm
Android studio
apache ant
PhoneGap
But even after installing and following the all the instructions given on the internet.I am not able to prepare my build for the testing purpose.
Below is the error I am facing/getting when running the command sudo cordova requirements
Requirements check results for android: Java JDK: installed 1.8.0
Android SDK: not installed 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. Android target: not installed Android SDK not
found. Make sure that it is installed. If it is not at the default
location, set the ANDROID_HOME environment variable. Gradle: not
installed Could not find gradle wrapper within Android SDK. Could not
find Android SDK directory. Might need to install Android SDK or set
up 'ANDROID_HOME' env variable. Error: Some of requirements check
failed
Note:I have already set the environment variable in .bashrc file ,but still facing the issue .
Please help!
in /home/user/.bashrc you must to set the ANDROID_HOME and PATH like this:
export ANDROID_HOME=/home/user/Android/Sdk/
and you PATH like this:
export PATH=/home/user/Android/Sdk/tools/:$PATH

Android variable creating issue when sudo meteor run android-device perform

export ANDROID_HOME=/home/haiderali/android-sdk-linux
export PATH=${PATH}:/home/haiderali/android-sdk-linux/tools
export PATH=${PATH}:/home/haiderali/android-sdk-linux/platform-tools
i added this on bashrc file and run this command "sudo meteor run android-device" it's give me environment error but I successfully installed all the tools required for meteor android build.
Your system does not yet seem to fulfill all requirements to build
apps for Android.
Please follow the installation instructions here:
https://github.com/meteor/meteor/wiki/Mobile-Development-Install:-Android-on-Linux
Status of the requirements:
✓ Java JDK
✗ Android SDK: 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.
✗ Android target: Android SDK not found. Make sure that it is installed. >If it is not at the default location, set the ANDROID_HOME environment >variable.
✗ Gradle: Could not find gradle wrapper within Android SDK. Could not >find Android SDK directory. Might need to install Android SDK or set up >'ANDROID_HOME' envvariable.
Please Somebody help. :(

"phonegap run android" phonegap 3 under windows can't build a project

I 'm trying to create a new project with phonegap3 :-
I set up the dev environment that include
node.js
Ant
Android SDK
and they all updated to the last versions
after creating the project , I get the directory for project:
EX :
phonegap create HelloWorld com.example.hello HelloWorld
but the main problem that I can't add the android platform to it
with the 3 comands as follow :-
trying to "phonegap add platform android"/"phonegap build android"/"phonegap run android"
I also installed throw the node the "cordova" and the same problem exists when I replace the phonegap with cordova !
Users\koko\test\www>phonegap build android
[ponegap] detecting Android SDK environment...
[ponegap] using the local environment
[onegap] adding the Android platform...
[error] An error occured during creation of android sub-project.
Users\koko\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.js:126
throw e;
^
Error: An error occurred while listing Android targets
at C:\Users\koko\.cordova\lib\android\cordova\3.3.0\bin\lib\check_reqs.js:87:29
at _rejected (C:\Users\koko\.cordova\lib\android\cordova
.........
at process._tickCallback (node.js:415:13)
I also uninstall the node and re-download it and the problem still exists !
I viewed many questions with people around this issue but I don't know where exactly the error !
I wish to see the project running inside the emulator !
It seems, that cordova failed to execute following command in shell:
>android list target
Why don't you try to execute it manually? It may produce more information about this problem.
Didn't you forget to add following folders to your PATH?
android-sdk/tools
android-sdk/platform-tools
EDIT:
The latest android SDK has different folder structure. note the "sdk" folder.
android-sdk/sdk/tools
android-sdk/sdk/platform-tools
Make sure, you have set the following system variables:
ANT_HOME = path to ant files
JAVA_HOME = path to java JDK (NOT JRE!!)
ANDROID_HOME = path to android sdk
After that, you have to add
%ANT_HOME%\bin
%JAVA_HOME%\bin
%ANDROID_HOME%\bin
to your PATH variable.
If it still doesnt work, make sure you have the Google USB Driver installed (this took me hours to find and fix -.-)

Why does my phonegap build android command not work?

i am new to phonegap 3 and android development.
i tried the command "phonegap build android" and get:
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
[error] An error occured during creation of android sub-project.
fs.js:427
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT, no such file or directory 'C:\Users\Michael\.cordova\lib\android\
cordova\3.1.0\VERSION'
at Object.fs.openSync (fs.js:427:18)
at Object.fs.readFileSync (fs.js:284:15)
at Object.exports.createProject (C:\Users\Michael\.cordova\lib\android\cordo
va\3.1.0\bin\lib\create.js:116:22)
at Object.<anonymous> (C:\Users\Michael\.cordova\lib\android\cordova\3.1.0\b
in\create:34:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
I simply add an empty file named as VERSION:
C:\Users\myuser\.cordova\lib\android\cordova\3.1.0\VERSION
after, I wrote this text inside it:
3.1.0
after, run phonegap again:
[phonegap] adding the Android platform...
[phonegap] compiling Android...
[phonegap] successfully compiled Android app
Good luck!
It is kind of tricky This is the sequence I have to go through.
run a clean in eclipse (Project Menu)
sudo phonegap build android (cordova if that is what you are using)
then you have to reapply the read write permissions to the whole folder (this step may not be needed depending on your permissions)
then in eclipse run refresh on the project
then build.
Run
I would suggest as a bare minimum first step you should check via the command line that the following commands return a response that shows they are working correctly. They are all required. Ant - http://ant.apache.org/
Java -http://www.oracle.com/technetwork/java/javaee/downloads/java-ee-sdk-6u3-jdk-7u1-downloads-523391.html
android - http://developer.android.com/sdk/index.html
In command line type the following to validate they work
Ant
java
android
Make sure you have node.js installed (http://nodejs.org/)
Also make sure you look at you PATH file and that everything is correct there.
As I say that's the basics (once you have stuff installed)
Try to install latest cordova. Maybe it will help:
$ sudo npm install -g cordova
(also you will need node.js installed)
I have removed android platform and added again.
cordova platform rm android
cordova platform add android
then,
cordova prepare android
is done without errors

cordova.cmd build android exited with exit code 1

I'm trying to run my application on an android emulator. I made all the coniguration necessary but it always returns me this error. Thank you for your help.
Error info :
cordova.cmd build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\comit\AppData\Local\Android\Sdk\ (DEPRECATED)
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
[ERROR] An error occurred while running subprocess cordova
environment variable :
ANDROID_HOME C:\Users\comit\AppData\Local\Android\Sdk\
ANDROID_SDK_HOME C:\Users\comit\AppData\Local\Android\Sdk\
JAVA_HOME C:\Program Files\Java\jdk1.8.0_231\
Path :
C:\Users\comit\AppData\Local\Android\Sdk\tools\
C:\Users\comit\AppData\Local\Android\Sdk\platform-tools\ C:\Program
Files\Java\jdk1.8.0_231\bin\
Emulator :
Nexus_5X_API_25
Try installing Gradle in your system
as you are using a Windows system follow the following steps
Step 1:-
Download the latest version of Gradle from here.
Step 2:-
Unpack the Gradle distribution ZIP into C:\Gradle using an archiver tool of your choice.
Step 3:-
Under System Variables select Path, then click Edit. Add an entry for C:\Gradle\gradle-6.0.1\bin.
Create a new environment variable called GRADLE_HOME and add C:\Gradle\gradle-6.0.1 value to it.
To verify Gradle installation execute gradle -v. It should return the gradle version.

Categories

Resources