I tried to update android in an existing phonegap project, told me fetching 7.0.0 ... completed. when I list platforms, it told me 6.3.0 was installed. So I did
phonegap platform remove android
phonegap platform add android
and copied my jks into platforms/android again.
phonegap build android (--release) is both telling me:
[phonegap] executing 'cordova build android' ...
[phonegap] completed 'cordova build android --no-telemetry'
But I cant find my outputs folder. Neither in platforms/android/build (I only have folder "android-profile" with a json and a rowproto file for every build) nor in platforms/android/app/build (there are folders "intermediate" and "generated"). I already searched for android-release-unsigned.apk and app-release-unigned.apk - nothing found.
Anybody an idea where to search or find out why it isn't created although there are no errors?
Thanks in advance
The answer can be found by adding "-d" to the build command. Then phonegap gives detailed information on build problems. In my case it could not find google-services.json
I faced the same issue and found that the output directory has been changed from ..platforms\android\build to ..\platforms\android\app\build\outputs\apk\debug
You could check the above directory.
Related
I'm trying to make an apk of the web app I made in babylonjs.
From my understanding you can use Cordova to convert a web app into an apk.
I was able to install Cordova and make its hello world apk download to my phone and open and run it just fine.
However my problem occurs when I put all of my web app files into the www folder in my Cordova project folder. After I do that Cordova gives me this error
Error: ENOENT: no such file or directory, stat '/Users/dylan/practiceApk/www/node_modules/.bin/nopt'
when I try to build the android version.
Here is some information about my setup I believe is relevant.
OS: Mac
cordova -v: 7.1.0
Cordova requirements:
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-26,android-24
Gradle: installed /Applications/Android Studio.app/Contents/gradle/gradle-4.1/bin/gradle
cordova info also gives this error(similar error I believe to the one above):
Error retrieving Android platform information:
Android SDK is not set up properly. Make sure that the Android SDK 'tools' and 'platform-tools' directories are in the PATH variable.
Error: android: Command failed with exit code ENOENT
But I tried a lot of different things to fix this. Most of them involved making the android tools in the path (er something..?) I also downgraded from the most recent version of Cordova and android. I believe the problem is in my web app node_modules/.bin/nopt
But I don't know why its is a problem.
Also im not sure how this affects it, but I'm not hosting the website anywhere I just assumed I can used Cordova to create the web app as an apk that could be used offline, all resource are in the project folder though.
Any ideas on how to fix this? I only started using Cordova today so I don't know much about it.
Thanks for your time!
Update: I tried building an iOS version and I get the same error. I believe this is an issue with my npm setup...
It seems that when I was copying over my project to the newly made Cordova project folder I also copied the node_modules folder and didn't actually initialize npm. After initializing it and then updating it would build the app.
I recently buy one ionic project, i had tried a lot to generate APK file but unable to successful.
First i download the file and run cmd.goto the files directory.
i run the command ionic platform add android , bit it says
After Executing ionic platform add android
if i rename ionic.project to ionic.config.json and again execute ionic platform add android it says * Looks like a fresh checkout! No ./node_modules directory found. Would you like to install proj
ect dependencies?*
After installing npm i execute ionic build --release android but it does nothing and gives me warning
[WARN] Not performing Ionic build for project type: ionic1.
[WARN] Error with .\www\lib\ionic\version.json file: FILE_NOT_FOUND, trying .\bower.json.
Warning
Please help me out i am badly stuck.
Had the same problem after updating.
ionic lib update does not work if there is no www/lib/ionic.
You can create it though by copying manually from node_modules/ionic-sdk/release.
This removed the FILE_NOT_FOUND errors for me.
I'm trying to build a project but when I type: cordova build android the following error occurred:
Generating config.xml from defaults
for platform "android"
Preparing android project
Compiling app on platform "android"
via command "../platforms/android/cordova/build"
Error: An error occurred
while building the android project.Error executing "ant debug -f "../platforms/android/build.xml"":BUILD FAILED /usr/local/Cellar/android-sdk/22.3/tools/ant/build.xml:932:The following error occurred
while executing this line: /usr/local/Cellar/android-sdk/22.3/tools/ant/build.xml:950:null returned: 1
Total time: 18 seconds
at ChildProcess. < anonymous > (/usr/local/lib/node_modules/cordova/src/compile.js:65:22)
at ChildProcess.EventEmitter.emit(events.js: 98: 17)
at maybeClose(child_process.js: 735: 16)
at Socket. < anonymous > (child_process.js: 948: 11)
at Socket.EventEmitter.emit(events.js: 95: 17)
at Pipe.close(net.js: 466: 12)
Is there a fix for this problem?
EDIT
I used brew to install Android-SDK and installed all possible build-tools:
And my android manifest looks like:
EDIT2
As requested here is the responce for cordova build android --verbose: http://pastebin.com/rqdkVKYG
I found the bug.
While testing, reinstalling android-sdk and ant. I tried to create a new project. Than typed in the terminal cordova build and it build flawlessly. After this I copied my existing WWW folder in to the new project. Typed cordova build again, it gave an error. Now I knew that the bug was in my WWW folder and not in the project itself. Scanning my folders I noticed a file with no extension(hidden files). I deleted the file and tried again. Success!
SUMMARY:
Scan your folders for files without extensions and delete or move them. Cordova doesn't like those.
EDIT
If this doesn't work try:
cordova platform rm android
then reinstall android using :
cordova platform add android
Now try to build.
try to run the command $home/.cordova/lib/android/cordova/3.3.0/bin/check_reqs to check if you have all the required components installed for android.
¿Did you add to windows path the sdk?
You can also try:
cordova platform add android
cordova build
try ant -v in your terminal and make sure it's above 1.8. Cordova requires that.
Also check path is given correct for Ant, Android-SDK/tools, and Android-SDK/platformtools
To debug exact issue try $Cordova build android --verbose
Let me know.
I Am upgrading my phonegap project(s) from phonegap 2.9.0 to the latest one, phonegap 3.3.0.
Because it has a lot of big improvements.
It's about an android project, but soon to be ios as well
However, I Am struggling with it a few days, and still no working code.
I have done this:
Installed phonegap and creted a new project like the the manual: http://phonegap.com/install/
After this I slowly inserted my old code into the www folder and installed the plugins on the new 3.0 way.
But whatever I do... I get this annoying:
Error initializing Cordova: Class not found
Because I used to run it in eclipse and use this debugging console (And did not find out how tot get the debuging from the cli to work... some more investigation to do there), I tried to get it working in eclipse.
But there, it does not have the cordova jar, and I can't find it anywhere.
I used to add the cordova-2.9.0.jar to the build path, but there is no cordova-3.3.0.jar.
I saw an answer abouyt creating it yourselve: but this was later remarked as not the proper way (ans since in no phonegap documentation this is mentioned... i cannot imagine that's the way)
In eclipse, this is causing the error: import org.apache.cordova.*;
So like I said... no cordova jar... hwo do you resolve this?
So a few questions all at once...
To get better debugging: how do i get this working in eclipse
Why do I get this error... class not found (probably related with
the missing jar)
None of the related questions gave a solution for me...
Edit
I was just going add, the steps in more detail, like I floowed this step:
http://docs.phonegap.com/en/3.3.0/guide_cli_index.md.html#The%20Command-Line%20Interface
but than I noticed... this command:
sudo npm install -g cordova
which I thought I had done, but I had done:
sudo npm install -g phonegap
But this does not make any difference.
Running it with: `
phonegap run android -V --device
`Gives:
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] compiling Android...
[phonegap] Generating config.xml from defaults for platform "android"
[phonegap] Compiling app on platform "android" via command "/Path to my app/platforms/android/cordova/build"
[phonegap] Platform "android" compiled successfully.
[phonegap] successfully compiled Android app
[phonegap] installing app onto device
[phonegap] Generating config.xml from defaults for platform "android"
[phonegap] Running app on platform "android" via command "/Path to my app/platforms/android/cordova/run" --device
[phonegap] Platform "android" ran successfully
but still gives the error as before.
And in eclipse still need to add the cordova jar, which is nowhere to be found..
Edit 2
I created a new project, just to see what happened when adding this to eclipse.. and it seemed to work. So I removed the project from ecplise... and added it (floowing the phonegap docs for thsi: new android project; Add from existing code). And now it creates a new jar named - cordova-lib.jar in the folder platforms/CordovaLib/bin
and this seems to work for eclipse... still the same error in the cli run command. But now I can try to run it from eclipse and find out more... (I will post it as soon as I find out what is the error)
Edit 3
running it in eclipse shows the error (weird that this is not shown in the -V mode of phonegap):
01-05 09:04:16.557: D/CordovaLog(698): file:///android_asset/www/phonegap.js: Line 1544 : Could not find cordova.js script tag. Plugin loading may fail.
01-05 09:04:16.567: I/Web Console(698): Could not find cordova.js script tag. Plugin loading may fail. at file:///android_asset/www/phonegap.js:1544
But why isn't this js file there....
EDIT 16-jan-2014
This is becoming a popular question too look at. So I am not the only one struggling with phonegap 3.x And here is another yet unsolved question: https://stackoverflow.com/questions/20953653/config-xml-phonegap-3-3-0-ignores-name-and-description
EDIT 21-jan-2014
Important note (see a lot of questions about this): the config.xml in the blueprint www folderis not the same as described in the phonegap docs. It has another schema, and is the blueprint for both the config.xml per platform, as a lot of other things and files (androoid manifest xml files, icons etc.). Unfortunately I have not found a proper description (besides the schema) of this config.xml file (only a good descrition of the platform dependent targets config.xml file) in the phonegap docs yet. And it is very confusing they choose the same name for a very different file...
EDIT 12-feb-2014
This might be helpfull... since I still cannot find a proper description of this so called blueprint config.xml on the phonegap pages: https://github.com/phonegap/phonegap-start/blob/master/www/config.xml
Edit 5 may 2014
Due to all problems in phonegap, the benefits of the principle behind phonegap has gone for me. (I still believe in potential phonegap can be the solution... but for now it's to premature). So I Am sorry i have to leave the phonegap path. I let this answer open for the ones still searching for answers... but do not expect any answers or the 'acceptance of the right answer' from me.
Because it kept complaining about the classes not being found, I suspected this was about the plugin classes. So I removed them all and reisntalled them, now it's working.
Remove all plugins and reinstall them
phonegap plugin list
[phonegap] org.apache.cordova.camera
[phonegap] org.apache.cordova.console
[phonegap] org.apache.cordova.device
[phonegap] org.apache.cordova.device-motion
[phonegap] org.apache.cordova.device-orientation
[phonegap] org.apache.cordova.dialogs
[phonegap] org.apache.cordova.file
[phonegap] org.apache.cordova.file-transfer
[phonegap] org.apache.cordova.geolocation
[phonegap] org.apache.cordova.inappbrowser
[phonegap] org.apache.cordova.media
[phonegap] org.apache.cordova.media-capture
[phonegap] org.apache.cordova.network-information
[phonegap] org.apache.cordova.splashscreen
phonegap plugin help
for all installs I did this (I couldnot find a * to deinstall them all at once)
phonegap plugin remove org.apache.cordova.device
and after that I reinstalled them, so for all plugins:
phonegap plugin add org.apache.cordova.device
This did the trick for me....
Edit
By the way, a few days later I found out that in case you run things in eclipse. You should add 2 projects. One of the complete project (as a general project, not android). There you can edit the code in the blue print WWW folder. And after editing, you run the cli (command line interface) command: 'cordova build' and than you can run it from the second project (you add the platforms/android folder as a android project, using add from existing code).
By the way, after having resolved this issue... I tried whether a complete new checkout for my phonegap project works in a complete new and fresh folder.
And therfore I used a little bash file that did this: (to run after the git clone command in the folder you just cloned):
unistall all plugins... (I copied the output of list and add phonegap plugin remove)
install all plugins ...
phonegap run android
and frustrated got the same message again....
than I found a blog of one of the phonegap hero's: http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/
And one remark especially: he created a hook for installing the plugins... but the hook is:
after_platform_add`
which means my order was wrong....
after the checkout, no platform is added, this is done in:
phonegap run android after
So installing the plugins before the platform is added... seems not to work!
I inserted a command to build (which also adds the platform) before installing the plugin in my bash file, and now it works.
but even better: use the hook suggested by Holly Schinsky in the link above... this works for all platforms, and not just on ubuntu (my bash file).
Well this page seems to explain it (I could only get to this answer by eclipse, the commandline interface (CLI) did never give me any warnings.
this error:
Could not find cordova.js script tag. Plugin loading may fail
lead me to:
https://github.com/phonegap/phonegap-cli/issues/134
and now it seems you have to change the code generated by phonegap create!!
<!-- <script type="text/javascript" src="phonegap.js"></script> -->
<script type="text/javascript" src="cordova.js"></script>
However... this does not help me, still the same error.
So I changed it back in to:
<script type="text/javascript" src="phonegap.js"></script>
I leave this answer, because for others this seemed to have worked (?)
I have cordova 3.3 installed (in 3.2, have the same error) and when i want to add or remove a plugin the system show this error:
>>cordova plugin add org.apache.cordova.network-information
Fetching plugin from "org.apache.cordova.network-information"...
Starting installation of "org.apache.cordova.network-information" for android
/usr/local/lib/node_modules/cordova/node_modules/q/q.js:126
throw e;
^
SyntaxError: Unexpected token
I check the path and is correct:
echo $PATH
/usr/local/bin:/Users/manuelcm/Documents/sdk_android/platform-tools:
/Users/manuelcm/Documents/sdk_android/tools:/usr/local/apache-ant/bin:
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
In my first installation i install the plugins and the plugins directories appear in /plugins/ but after build in iOS only de device plugin appear in /platforms/ios/www/plugins this is the reason that I want to reinstall the plugins.
Anyone know why this is happening and how to resolve it?
Finally I solved the problem, first I created the project in local disk.
The problem persisted, then I created the project with uppercase in the first letter of project name, and all works fine. Yes, it seems incredible, but this was the solution.
I had the same problem after I upgraded to cordova 3.3.0, when I tried 'cordova rm' the plugins (after I removed android.json from the plugins folder).
But the problem resolved for me when after I ran 'cordova add' all the plugins.
So I suppose you could try 'cordova plugin list' to see if it knows which plugin is added.
if it does know then try removing 'plugins/android.json' then add each of the plugin back in follow by 'cordova build'.
Also if you have angularjs, you might want to remove the /docs for it as it could also produce the error
And you might want to check your /platform/android/project.properties is it using a target that you are expecting? (e.g. android-16 but you don't have it set up?)
I had similar issue while installing org.apache.cordova.dialogs plugin. I deleted content under www folder and executed the same command. It worked. Under www folder I had my project which uses Angular. Not sure if angular has any conflict with this.