I'm trying to start a simple Cordova 3.0.0 project under Windows. Development environment (including Java, Eclipse, Ant, Android SDK) does exist and has been already used for numerous native apps.
I was able to create a "hello" project using:
>create hellocordova com.example.hellocordova "HelloWorldCordova"
Creating new android project...
Building jar and js files...
Copying template files...
Copying js, jar & config.xml files...
Creating appinfo.jar...
Copying cordova command tools...
Updating AndroidManifest.xml and Main Activity...
It worked ok, though there are no distro files in the project.
After that I've tried to build Cordova's distro files using update:
>update hellocordova
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.
Building jar and js files...
Copying js, jar & config.xml files...
Copying cordova command tools...
It does not show any errors, but the files cordova-3.0.0.jar and cordova-3.0.0.js are missing in respective folders (libs and assets/www) where they should appear.
The problem could possibly be related to API Level (though I'm not sure how). check_reqs reports:
Please install Android target 17 (the Android 4.2 SDK).
Yes, I have 4.1 as the highest API level at the moment and would like to keep it so. But I don't see in Cordova scripts any indication that the level must be exactly 17, except for the check_reqs itself, which seems not involved in building process.
I'd appreciate suggestions how to fix this.
It looks like I missed the step which does actually build the jar-file:
ant jar
for Cordova framework project. I didn't see this in the documentation.
After further investigation I found that create and update executes this command inside:
exec('ant.bat -f \"'+ ROOT +'\\framework\\build.xml\" jar');
The problem is that the command executes well manually, that is it produces the jar, but it silently fails to produce it when invoked inside create or update. For clarity I outputted the resulting command line from update, then copy & paste it and run in shell in the same directory. This works properly.
I had the same problem as you for the last couple of hours and problem came (silently as you said :D) from ant. My version of ant was not recent enough (1.7 instead of 1.8).
After updating it seems to work great (jar generated in correct file) even automatically (read inside the phonegap command scripts like run android).
I had the same issue but i was missing
ANDROID_HOME=C:\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_17\bin
And the Path to Java.
the -d ( i think debug ) will give you more information.
create -d hellocordova com.example.hellocordova "HelloWorldCordova"
this was on Cordova 3.0.9 and adt-bundle-windows-x86_64-20130729.
Als do not forget to update the SDK so the you have the corect Android platforms.
Related
I'm attempting to build a cordova app to release to android devices but receiving the following error message:
"Error: No Java files found that extend CordovaActivity"
It appears that the source of the error is that build folder that is to contain the source files is not being built. That is, the files that are to be created in the folder "src" isn't generated during the build and so the following warning is returned during each build:
ls: no such file or directory: ...\platforms\android\src\io\cordova\myappedc27c*.java
That is, the directory path "..\io\cordova\myappedc27c" is not being created.
Currently running Visual Studio 2017 version 15.7 on Windows 7 Pro.
Any help is appreciated.
ionic cordova platform rm android then ionic cordova platform add android#latest command solved the problem for my Ionic 3 application.
This happened to me after renaming the default Cordova config and package names. I fixed it by doing the following:
cordova platform remove android
cordova platform add android
Substitute android for each platform you'll be using.
I am developing an Ionic (5) app and saw this randomly pop up as well. Removing just the android platform under platforms wasn't good enough. I removed the entire platforms directory and while I was at it, also removed out-tsc, plugins and www.
If there is official cordova documentation for this, I couldn't find it and would appreciate a link. I have run cordova run android to deploy to my phone. Things look good. Now I'm ready to turn this into an official app that users can download on the android play store? When I build my app it generates a file named "CordovaApp-debug.apk". That "debug" part makes me think this is the wrong file to work with, but I'm not sure how to generate the right file.
Deploying a hybrid app to the Google Play Store
These steps would work for Cordova, PhoneGap or Ionic. The only difference would be, wherever a call to cordova is placed, replace it with phonegap or ionic, for your particular scenario.
Once you are done with the development and are ready to deploy, follow these steps:
Open a command line window (Terminal on macOS and Linux OR Command Prompt on Windows).
Head over to the /path/to/your/project/, which we would refer to as the Project Root.
While at the project root, remove the "Console" plugin from your set of plugins.The command is: cordova plugin rm cordova-plugin-console
While still at the project root, use the cordova build command to create an APK for release distribution.The command is: cordova build --release android
The above process creates a file called android-release-unsigned.apk in the folder ProjectRoot/platforms/android/build/outputs/apk/
Sign and align the APK using the instructions at https://developer.android.com/studio/publish/app-signing.html#signing-manuallyAt the end of this step the APK which you get can be uploaded to the Play Store.
Note: As a newbie or a beginner, the last step may be a bit confusing as it was to me. One may run into a few issues and may have some questions as to what these commands are and where to find them.
Q1. What are jarsigner and keytool?
Ans: The Android App Signing instructions do tell you specifically what jarsigner and keytool are all about BUT it doesn't tell you where to find them if you run into a 'command not found error' on the command line window.
Thus, if you've got the Java Development Kit(JDK) added to your PATH variable, simply running the commands as in the Guide would work. BUT, if you don't have it in your PATH, you can always access them from the bin folder of your JDK installation.
Q2. Where is zipalign?
Ans: There is a high probability to not find the zipalign command and receive the 'command not found error'. You'd probably be googling zipalign and where to find it?
The zipalign utility is present within the Android SDK installation folder. On macOS, the default location is at, user-name/Library/Android/sdk/. If you head over to the folder you would find a bunch of other folders like docs, platform-tools, build-tools, tools, add-ons...
Open the build-tools folder. cd build-tools. In here, there would be a number of folders which are versioned according to the build tool-chain you are using in the Android SDK Manager. ZipAlign is available in each of these folders. I personally go for the folder with the latest version on it. Open Any.
On macOS or Linux you may have to use ./zipalign rather than simply typing in zipalign as the documentation mentions. On Windows, zipalign is good enough.
When was the cordova.jar file removed from Cordova and replaced with CordovaLib? I was previously running Cordova 3.1.0-0.1.0.
Today I have upgraded to Cordova 3.3.0 (which was quite a headache, but I've completed the upgrade) and I've noticed a difference in my Android project structure: Cordova has created my project (with what I've named it) and it has also created -CordovaLibs.
Is this right? I know iOS it does this - but not Android (as I say, usually a JAR is added).
It's introduced in 3.3, had me baffled too.
Cordova 3.3 release notes:
http://cordova.apache.org/announcements/2013/12/16/cordova-330.html
CB-5232 Change create script to use Cordova as a Library Project
instead of a .jar
To generate file cordova3.3.0.jar, just follow these steps bellow:
Open your cmd, and go to the root folder where Cordova is installed:
$ cd ~/.cordova/lib/android/cordova/3.3.0/framework
Run the following command, notice the trailing dot
$ android update project -p .
Use ant to generate file jar. Be sure you have configure PATH for
$ ant jar
Now, you can copy file cordova3.3.0.jar to libs directory and import to your project. Hope it's helpful
Hi I have problem upgrading Phonegap from 2.5.0 to 2.6.0 and 2.7.0 and specifically with step 8. I'm following the steps from the documentation Upgrading Cordova Android
Copy files from bin/templates/cordova to the cordova directory in your project
Where should I put those files, so they could upgrade my project?
The Android Phonegap conversion docs have changed significantly. There's no longer a step by step process that walks through each upgrade requirement. Instead, theres an "update" program that theoretically does the upgrade automatically. It didn't exactly work this way for me. After going through the documented update process (one step now) I had to go through my project and make sure everything was in place - specifically the cordova-2.7.0.jar and the cordova-2.7.0.js files.
I've just finished upgrading an Android project from Phonegap v2.5.0 to Phonegap v2.7.0. The process I followed was:
Back up the Android project.
Execute the Phonegap update command for v2.7.0 as described in the PG upgrade documentation
Change the current directory to Phonegap for Android directory:
$ cd /phonegap-2.7.0/lib/android
Execute the update command:
$ ./bin/update YOUR/CORDOVA/PROJECT/DIR
Ensure that Eclipse is referencing the correct Phonegap library in the libs directory: cordova-2.7.0.jar.
I also deleted the reference to the previous jar file.
Make sure that the phonegap javascript file (cordova-2.7.0.js) is referenced appropriately in the index.html file.
From within Eclipse: Project/Clean
Build the project and test.
I'm also trying to upgrade from 2.5.0 to 2.7.0 and running the update.bat file gave me the following message: Missing one of the following: JDK: java.oracle.com Android SDK: developer.android.com Apache ant: ant.apache.org – Etienne Desgagné May 27 at 2:15"
You need to check your 'path' System Variables in Environment variables under advanced system settings. JDK is the Java Development Kit and you check if it's correct by 'echo %JAVA_HOME% in a terminal. Ant is an apache thing and again you check that's correct by 'echo %ANT_HOME% and then you just need to make sure your Android SDK folder is in the path variable.
I followed their "how-to":
Phonegap Start
Phonegap wiki
I have succesfully installed the android sdk, but I can not install phonegap 1.3.0. I'm stuck at this step: Step 4. Build the Example PhoneGap App
4A. Open a command window and change directory ('cd') to the 'phonegap-android' folder. In Windows, use git bash as the command window. In Mac OS, use Terminal.
4B. Run the following command. This will create a PhoneGap.jar file and create a basic Android Eclipse project in the output path that can then be opened in Eclipse.
NOTE: The droidgap script has been updated and now there are two methods to create the necessary files. The new script is significantly simpler to use than the old method. For those who prefer the old method, it is still available.
NEW METHOD:
4C. From the 'phonegap-android' folder, run 'ruby bin/droidgap create [path_of_application]'. For the example app, the command would be 'ruby bin/droidgap create example'. If the example folder does not exist inside 'phonegap-android', run 'ruby bin/droidgap gen' first.
These are the steps that I have took:
I have downloaded the callback package from git (see wiki)
I run git bash --> cd to the phonegap-android folder
I run this command: 'ruby bin/droidgap gen'
Then I get: No such file or directory -- bin/droidgap(loadError) and idd the file isnt there.
I can't find droidgrap, who has the anser for me....... The old method don't work either, because I need droidgap for that one 2.
In the end I want to develop a Sencha web app for my android device. What did I forget.... :'(
The AppLaud Eclipse plugin documented on the PhoneGap wiki here eliminates the need for droidgap or any other configuration. Its wizard creates a fully configured PhoneGap for Android project.
(Note: I developed the AppLaud plugin)