Ive finnished a final year project using phonegap on OSX and i want to make a APK for user testing.
When i've been testing the app on my android tablet i use
phonegap run android // or // cordova run android
it builds and goes onto my android device fine, works properly and all the plugins work fine, however i want to be able to make its own .APK file so friends can test it and give me feedback.
I was told to use
phonegap build android --release
When i use this command it will fall over with an exit code 1 saying i may not have the required platform or OS to build this project, despite when running the previous command it says build fine.
Error code in CLI
BUILD FAILED
Total time: 4.202 secs
/Users/robertlemm/Development/phonegap_dev/Little_Scavngers/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/robertlemm/Development/phonegap_dev/Little_Scavngers/platforms/android/gradlew with args: cdvBuildRelease,-b,/Users/robertlemm/Development/phonegap_dev/Little_Scavngers/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/robertlemm/Development/phonegap_dev/Little_Scavngers/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /Users/robertlemm/Development/phonegap_dev/Little_Scavngers/platforms/android/cordova/build: Command failed with exit code 1
I've ensured android tools & platform tools are up in my $PATH, checked SDK manager to ensure ive got version 14 to latest installed, checked the Platforms.JSON file to ensure the versions are set to the minimum, the config.xml
says <preference name="android-minSdkVersion" value="16" />
Honestly not sure how to do it
Have you tried removing and adding again the android platform?
I remember having this issue several times and fixing it by just doing that.
Related
I have a problem several days ago, I work in ubuntu and I would appreciate it very much if you help me :( I have a personal project that is finished and I want to get the apk, when I create the apk with ionic cap build I don't get any error, just a warn of Plugins are missing dependencies which I don't think is a problem, worse when I run ionic cap run and select the device either external or emulator I get Running Gradle build - failed! and at the end An error occurred while running thread capacitor. ionic cap build warning ionic cap run ERROR Also when I create the apk android studio opens automatically and I get this message: Error: Android Studio
WARNING
ERROR BUILD
Error Android Studio
I already tried deleting the node_modules folder, installing android studio, node, java,
gradle although I don't know if it installed correctly, etc.
1st image: You're missing the es6-promise-plugin. you need to install it
2nd and 3rd image: you are using an old version of gradle, which it is making it incompatible with what the compiler uses (8+). You need to install new version of gradle.
I'm using windows 10 64-bit system
I'm running default flutter project code on my real device ( Samsung A30)
and I also enabled USB debugging on my phone.
All android versions are installed in my Android Studio. I also updated Flutter SDK and my Gradle is also updated.
I also gave path of flutter sdk in my environment variables.
Still, I'm facing error while running flutter project like
"Finished with error:gradle task assembledebug failed with exit code
-1".
I even uninstalled Android Studio, Dart and removed Flutter and again installed everything, but still getting the same error. VS Code is also giving same error.
What can I do to fix this error?
You are not enable in your developer options install via USB.
I'm using Ubuntu Gnome 14.04 64 Bit (for the moment) with kernel 3.19.0-33-generic.
I created a new app (a clean one, no plugin, no www folder with content) to try to build it.
After type in the bash "cordova build android"
I get this error:
Running command: /home/aby/Desktop/testApp/platforms/android/cordova/build
[Error: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.]
ERROR building one of the platforms: Error:/home/aby/Desktop/testApp/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /home/aby/Desktop/testApp/platforms/android/cordova/build: Command failed with exit code 2
Now if you printenv | grep android
You will get
ANDROID_HOME=/opt/android-sdk-linux
ANDROID_PLATFORM_TOOLS=/opt/android-sdk-linux/platform-tools
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools:/home/aby/bin:/home/aby/opt/jdk8/jdk1.8.0_45/bin:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools
ANDROID_SDK=/opt/android-sdk-linux
You can see that the variables exist, in fact before I run cordova build android I had to use cordova platform add android and its works with no problem.
So I found this Bug, and tried some solution like update android(project) or remove and install it again with no success.
I reinstall the Andoroid SDK, and updated the "/.bashrc", "/.profile" and "~/.pam_enviroment" with the environment values and also this not help.
So how can I fix this? How can I build my app with no error? What I missing?(If you consider that you need another information please tell me).
Thanks, in advance.
At the end I could fix my problem when I change the "Owner" / "Group" to the android sdk folder and Permission to "/tools/android".
Here a link to my previous question, and the solution (at least for me) to fix this error.
In my Windows 7 machine, I had ionic build android working. I could build the apk, deploy/debug with ionic run android --livereload --consolelogs etc. All of sudden (as in I don't know what possibly could have caused this), the ionic build android stopped working. When I try to run it, it freezes in this screen:
ajunior#DES6635D C:\src\to\my\project
> ionic build android
Running command: "C:\Program Files\nodejs\node.exe" C:\src\to\my\project\hooks\after_prepare\010_add_platform_class.js C:\src\to\my\project
add to body class: platform-android
Running command: cmd "/s /c "C:\src\to\my\project\platforms\android\cordova\build.bat""
Event after an hour or so, no output is given; I have to manually break the process with Ctrl+C.
Any suggestions? The strange thing is that this was working this morning (and all the other days for the last two weeks), so I believe that it's not related to PATH, Android SDK or anything like that. Nothing was installed, uninstalled or updated in this time. I already tried restarting the machine, but that also didn't work.
When in path via cmd run: cordova build android --ant
It will build like that (you must have ant installed of course).
Then: cordova run android
If cordova run android gives issues just fetch the apk from the build folder in your ionic project:
platforms\android\build\outputs\apk
Then allow cellphone to accept Unknown Sources, copy the file to your phone and install.
I am trying, to no avail, to run an Android version of a Phonegap app I have made.
The app works fine on iOS when running:
phonegap run ios
However, when I run:
phonegap run android
I get
[phonegap] executing 'cordova run android'...
[phonegap] completed 'cordova run android'`
But nothing happens. When I run:
phonegap run android --verbose
I get the error(s):
BUILD FAILED
/usr/local/Cellar/android-sdk/24.1.2/tools/ant/build.xml:601: The following error occurred while executing this line:
/usr/local/Cellar/android-sdk/24.1.2/tools/ant/build.xml:653: The following error occurred while executing this line:
/usr/local/Cellar/android-sdk/24.1.2/tools/ant/build.xml:698: null returned: 1
and
ERROR running one or more of the platforms: Error: /Users/*/Google Drive/Websites/angular-phonegap/*/platforms/android/cordova/run: Command failed with exit code 1
You may not have the required environment or OS to run this project
I faced a similar problem in the past that involved editing my PATH variable, not sure if this is the same issue or what. In any case, any help is greatly appreciated.
Thanks
i think that you not have all requirements, please check another time, as you can see here, cordova fail with this error where not find a specific platform command to run.
Follow these instruction:
Check that the java sdk is already installed and already in your Path.
Check to have already installed android studio or sdk standalone and the bin folder of the sdk is in Path.
Check to have installed ant ( on Mac install it with brew, this is the best option ) and to have it in path.
For a complete list to check refer to this cordova docs.
Be patient and follow the step one by one, your problem must be in one of these steps.