I this documentation:
I cloned the latest Cordova here: https://github.com/apache/cordova-android
But when I run "ant jar" as described in the documentation, I get this error:
cordova-android-master/framework/build.xml:124: Cannot find /Users/neigaard/Library/Android/sdk/tools/ant/build.xml imported from /Users/me/cordova-android-master/framework/build.xml
Google say that is because ant/build.xml
was removed from Android SDK. I found a post saying that I should download a old Android SDK tools and replace my SDK tools folder with that, but I rely on my Android SDK to be working and up to date.
Is there no way to build the Cordova Android jar without an outdated Android SDK or is there somewhere I can download a pre-built jar or is there another way to integrate Cordova into a existing Android app?
2 Answers
Answers 1
You don't really need the .jar anymore, Cordova is distributed through gradle, so you can just add this in the dependencies section of your app gradle file:
implementation 'org.apache.cordova:framework:7.1.0'
Answers 2
You don't required to use complete outdated Android SDK.You have to just place ant/build.xml in tools folder. Below are the steps to create corodva.x.x.x.jar on Windows
Step-1 Download Android tool package from below location: https://dl.google.com/android/repository/tools_r25.2.5-windows.zip
Step-2 Copy ant folder to
C:\Users\xxxx\AppData\Local\Android\sdk\tools
Step-3 Install Cordova using npm
npm install -g cordova
You can install specific version of cordova using cordova@version.
Step-4 Go to below location and copy your local.properties from your android project: C:\Users\xxxxx\.cordova\lib\npm_cache\cordova-android\x.x.xx\package\framework
Step-5 Navigate to the Android package's /framework directory and run ant jar. It creates the Cordova .jar file, formed as /framework/cordova-x.x.x.jar
FYI: It is recommended to refer the cordova requirements-and-support https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#requirements-and-support
However tutorial cordova.apache.org/docs/en/latest/guide/platforms/android/… looks outdated. If you just want to embed a cordova webview you don't really need the .jar anymore, you can follow this one docs.phonegap.com/develop/1-embed-webview/android
0 comments:
Post a Comment