I've done to create a phonegap 2.5.0 project template by following Getting Started with Android on Windows.
I'm using the ADT Bundle IDE from Get the Android SDK. After I setup new Android project from existing code, I get few errors that prevent building the project. I've solved AndroidManifest.xml, main.xml, strings.xml, config.xml. But I'm still getting the major error which is
Archive for required library: '~/libs/cordova-2.5.0.jar' in project 'xxx' cannot be read or is not a valid ZIP file
Does anyone facing this problem before?
To make things easy, you can create the project by using the command create provided with the phonegap package. Once created, you should be able to directly compile it without any errors.
To answwer your question, make sure you have cordova-2.5.0.jar in your libs. If not, add it using right click on project -> Build Path -> Add external archives. Then choose the jar.
Related
I want to use Flutter to create an Android app which depends on a third-party SDK that wrapped in an aar file. So far, I have only found the article Accessing Platform and Third-Party Services in Flutter. It seems that I have to build the Flutter project with additional Java files using Android Studio. This is complicated and not what I want.
Is there any way to directly load aar files or *.so files in Dart code? Something like how JNI works.
After learning the Flutter example - hello services, I have successfully built my Flutter project with aar file.
Basic Steps:
Download the Flutter source code.
Open flutter/examples/hello_services/android in Android Studio.
Click File > New > New Module and choose Import .JAR/.AAR Package.
Press F4 to open Project Structure, and then add the dependent module.
Write Java code to invoke APIs that defined in aar file.
Import flutter/examples/hello_services to Intellij IDEA.
Build and run the Flutter app.
I've pushed the source code to GitHub.
If you want to add .aar file to your Flutter project and faced problem in Android Studio saying
" can't understand Gradle settings file, please add the path ':moduleName' manually"
this tutorial is how to add Android .aar module to your flutter project manually.
https://www.programmersought.com/article/84681807320/
Actually, I am very newbie about Cordova. I am building a push-notification function(OneSignal) on my cordova project.
First, I created the cordova app like this :
C:\>cordova create newGenNo15 io.newgen.newGenNo15 NewGenNo15
C:\newGenNo15>cordova platforms add android
C:\newGenNo15>cordova plugin add onesignal-cordova-plugin
And then, imported this to Eclipse.
File > Import > Android > Existing Android Code Into Workspace
But, I found errors in Java file.
I tried to solve this problem. But I couldn't make it.
Even I modified build.gradle file like adding classpath and compile, but I failed.
Do i have to solve this problem?
You will need to extract classes.jar file from the OneSignal .aar file. However I recommend just sticking with the standard Cordova build command instead of using Eclipse.
cordova build android --release
If you must use an Android project to add custom Java code I recommend using Android Studio over Eclipse. Google has stopped supporting Eclipse since the end of 2015.
I am trying to add datepicker plugin in my phonegap application.
I created phonegap application using the eclipse.
Steps :-
1) First i created the android project in eclipse
2) After i added the cordova.js and cordova.jar file to project and converted that project to the phonegap project.
Now project is working fine.
But when i am trying to add datepicker plugin to the application using "cordova plugin add https://github.com/VitaliiBlagodir/cordova-plugin-datepicker"
I am getting error
Current working directory is not a Cordova-based project.
and when i am trying to add using "phonegap local plugin add https://github.com/VitaliiBlagodir/cordova-plugin-datepicker"
I am getting error
[Error: project directory could not be found]
[error] project directory could not be found
I dont know what problem i am getting here.
How can i add datepicker plugin manually using the eclipse.
My project structure is
Looks like you are trying with cordova version 1.6!!! It's too old, now cordova version is 3.5 as of today.
Here is the up to date documentation link for 3.5.
For starters, there are no more plugins.xml file in cordova.
You should create the project using command line cordova commands (introduced after 3.0 as far as I remember) so that folder structures and config.xml file (plugins and other configurations are in here), etc, are also formed. Doing it manually is almost impossible imho.
That's why you are getting error about working directory. I am confused and surprised that you are getting some error message at all.
do you add from command line ? if yes/ check the path, maybe you aren't in the project path,
if you were in the parent folder of the project root, the command not work.
for example:
c:\phonegap-projects\cordova add something
above command isn't work. you must be in the Cordova project path:
c:\phonegap-projects\MyApp\cordova add something
also you can check with this:
cordova plugin add https://github.com/VitaliiBlagodir/cordova-plugin-datepicker
hope be useful.
I have just set-up my local jenkins installation on my mac...
Now i have tried to create an ant built which builds my app as soon as i check-in a new change. The ant script is working great as long as i only use it in the project...
cd into the folder
ant release
It is able to find all library projects i'Ve included (ActionBarSherlock, ViewPagerIndicator, NineOldAndroids, HoloEveryWhere, PocketChange)
As soon as i put this on my jenkins installation everything breaks.
My main folder-organisation is like this:
Projects/Project
Projects/ProjectLibrarys/Library
Eclipse referes to those libraries like this: android.library.reference.2=../Project Librarys/ActionBarSherlock/library
I can't use absolute links (because i think they will fix the issue) but eclipse or ant doesn't like them.
I have really no idea how to fix it?
Will i have to edit the build.xml (i've added it into the folder ext/commonbuild/commonbuild.xml so i have the same android build file for all my projects)
If you need more code let me know.
Thanks in advance...
Ok i was able to solve my issue by adding a customproject.properties file with a seperate link for the build.
There is still one issue. It seems that ant doesn't use the customproject.properties for my library project i've added. This library project includes another library project and as soon as i build it has a wrong relative url.
Does someone know how to use the customproject.properties even for the project libraries?
As bluszcz mentioned, I checked out two modules and i was able to build my apk via Jenkins without having two project.properties or customproject.properties file.
On Jenkins Configure Screen, Under Source Code Management - Subversion Modules,
Give the url for your android project (say, SampleAndroidProject)
https://goxxx.com/svn/repository/projects/trunk/SampleAndroidProject
Provide local module directory as 'SampleAndroidProject'
Provide the svn url for your library project (say, google-play-services_lib)
https://goxxx.com/svn/repository/projects/trunk/google-play-services_lib
Provide local module directory as 'google-play-services_lib'
Save and build again.
In order to implement different versions of our UI we broke our program up into UI specific code and a common library project that has everything else. Up until yesterday when I updated to ADT 14 everything was working fine. Now I can't build. I keep getting the error "The container 'Library Projects' references non existing library 'path to the bin folder of my common project and the name of the project.jar'
I've been all over the web and tried everything I can think of to fix this to no avail. Can someone help me out? I'm basically stuck at this point.
Maybe you have the same issues I had when switching to the new ADT:
In my previous setup I had some resources split between the library and the main project. The library project would not compile error free on its own but only in combination with the main project which added the missing resources.
It doesn't work like this any more.
The library project must compile completely error free now. When it does the build process will create a <lib_project_name>.jar in the bin folder of the library project.
If the jar file is not created ( thus the build process of the library project failed for some reason - eg. because the changes in the R.java file (see http://tools.android.com/recent/buildchangesinrevision14 )) you will get the error message you described.
Also, I had to manually remove the <lib_project>_src from the project.
I've had a problem with a few different projects where I did the fixes suggested in the other answer, but they were only fixed temporarily.
Every time I reopened Eclipse or did a Clean on a project, the "Library Projects" directory would disappear, and I would have to open the project properties, remove the library, and add it again.
I solved this the hard way by creating a new project and copying everything into it.
Then I found an easy way to solve it. Right click the project, Refactor-->Rename. You can rename it back afterwards. This fixed it.
Check out the article "Changes to Library Projects in Android SDK Tools, r14" ( http://android-developers.blogspot.com/2011/10/changes-to-library-projects-in-android.html ) on the Android Developers blog.
E.g. #P.Melch: "I had to manually remove the _src from the project" should be done as follows:
To fix the project, you must remove the extraneous source folders with the following steps:
Right click source folder and choose Build Path > Remove from Build
path.
A dialog will pop up. In it, make sure to check “Also unlink the folder from the project” to completely remove the folder.
You have to update the Android SDK in Android SDK Manager
Android SDK Tools Intalled
Android SDK Plataforms Installed
Android SDK Builds Installed