I am trying to update my phonegap 2.1 project to the new 3.3 version. When I try and make a new project within Eclipse it does not include my source code into the project. I have tried making a project from the root of my project directory and from the root\platforms\android with the same result. Each time it makes a project using the CordovaLib directory and not my assets\www directory. I found another user with the same issue... Developing with Eclipse and Phonegap/Cordova 3 However this solution did not seem to work. If I make a project with existing code from either two locations my source code(www) directory is not used. I am using Eclipse SDK Version: 4.2.2 Build id: M20130204-1200. Any help is much appreciated!
Creating a new workspace solved this problem for me.
Related
my tries
click right at my project , choose Export ---> android
---> Generate Gradle build files
I stop in this point , I cant force overriding, any one know the reason
The Eclipse IDE uses a different file structure for their android projects, as opposed to the files structure of the projects created through Android Studio. Regardless of the Gradle builds and so on.
Your best bet would be to create a new Android Project based on the specifications of your Eclipse project. And migrate the source code as required. As far as the libraries are concerned, you can add them directly to the Android Project.
I also found that this might be useful for your current situation. Help on Migrating from Eclipse to Android Studio (Projects).
Hope this helps.
INTRODUCTION:
I exported android project from Unity version 4.6.1f1. After that, I imported it in Android Studio. I worked on a project for a few days and everything worked as supposed to.
When I change something in Unity, I just export android project again. In android studio, I delete ASSETS folder and then paste the new one that I get from Unity export. I did this in Eclipse to update my project. I am doing it now and everything works just fine.
PROBLEM PART:
Then, I updated Unity to version 4.6.2p2. I exported android project again. I changed ASSETS folder as usual. I also changed unity-classes.jar. I used this method in Eclipse before and it worked for me (apparently it worked for a lot of people, as my research on the internet confirmed it).
This does not work in Android Studio. I get error
Invalid serialized file version. Expected version: 4.6.2p2. Actual version: 4.6.1f1.
I tried: restarting Android Studio; cleaning and rebuilding project; syncing gradle; using other versions of Unity,... I also tried removing all dependencies, cleaning project, then adding dependencies again and rebuilding project.
I did not find any reference to this problem on the internet.
The only solution I get so far is to import project in Android Studio as new one and then do all the work again. But that is very undesirable.
Did anyone has this problem and come up with a solution that will not require making new project from scratch?
I did more research and here is the solution.
The problem is that Unity doesn't export all libraries together now. Specifically, libmain.so libmono.so and libunity.so are now separated and you need to change them also after you export project with new version of Unity (changing unity-classes.jar and assets folder is mandatory as before).
When you export project from Unity, you can find those libraries in libs/armeabi-v7a folder. In Android Studio, you can find them in src/main/jniLibs/armeabi-v7a folder.
I have an Android project created in Android Studio. It works fine in Android Studio, IDEA and build machine.
Now we have several new developers who work in Eclipse and I can't set it up. Is it possible to convert gradle(android studio) project to Eclipse IDE?
You'll have to maintain the build separately in both Gradle and Eclipse; Eclipse can't use the Android Gradle builder natively. It's on our list of things to implement but we don't have a roadmap for it yet.
Things will go easiest if you use an Eclipse-like directory structure and adapt the Gradle build file to work with it. See Maintaining directory structure during Android Studio import for advice.
Use Eclipse Compatibility Mode in Android Studio and Idea.
Or
Use Gradle and the new Build system in Eclipse: Is there any way to integrate Eclipse with Gradle in Android project?
I've dabbled with Phonegap using Eclipse and the ADT plugins in the past and I'm now trying to get my head around doing this in the new Android Studio IDE.
Since Phonegap v3 seems to rely on some kind of NodeJS commandline installation thingy, of which I know absolutely nothing about, I've downloaded Phonegap v2.9 instead. Also since Android Studio is so new and the documentation seems to only cover importing existing Eclipse projects or projects built using Phonegap's commandline, I'm instead trying to follow old Eclipse documentation.
To get to the point, I've created a project in Android Studio and verified that it runs. I've then created /assets/www and copied cordova.js and a basic index.html file in. I've copied cordova-2.9.0.jar in to /libs and right clicked to 'add as library'. Finally, I've amended MainActivity.java and AndroidManifest.xml accordingly.
The problem though is that when the build gets to 'import org.apache.cordova.*;' in my MainActivity.java file, it's erroring out with 'Gradle: package org.apache.cordova does not exist'.
Could somebody please point me in the direction of some documentation on creating a Phonegap ap using Android Studio (rather than importing in from Eclipse or from something created via Phonegap commandline), or even just describe how I'm supposed to edit the build.gradle file so that Gradle can find Cordova?
Much appreciated.
Ric is really easy to work with Phonegap and ANDROID Studio.
Here is what i am doing:
Creating Phonegap project: phonegap create testproject com.testproject.name Name;
Enter Project directory: cd testproject;
Add Android platform: phonegap build android;
You have your phonegap project ready. Now open Android Studio. Select Import project and follow instructions. If you don't have any plugins added in your project it's preaty pushing NEXT till you get to the end.
That's all. If you need more information tell me will be happy to help you.
If you prefer snapshot you can find a very easy to follow tutorial here:
Phonegap and Android studio
When I try to build my project in Android Studio I get the following error, using the gradle plugin provided with the download (v 1.6):
The specified Gradle installation is not supported by this tooling API version (1.6, protocol version 4)
When I downgrade to gradle 1.3, 1.4 or 1.5, I get this error:
Gradle: : java.lang.ClassNotFoundException: org.gradle.tooling.provider.model.ToolingModelBuilderRegistry
The project was originally created in Eclipse, the exported using the build gradle file option, then imported into Android Studio.
Does anyone know what I can do to fix these issues? Many thanks.
I had a similar problem and I believe that it was caused by having multiple versions of gradle on my machine. The solution I found was to use the script that Android Studio creates in your project folder (either gradlew (MacOs/Unix) or gradlew.bat (Windows)):
./gradlew assemble
This causes the correct version of gradle to be run - i.e. the version that was shipped with Android Studio.
I haven't tried creating a project within Eclipse, so I'm not sure if these scripts are created when creating your project in that way.
I think the problem is with the way Eclipse 22 exports the project. In the end the way I got my project transferred over was to create a new project in Android Studio and copy over the files from my Eclipse project into the appropriate directories in the new project.
The directory structure of projects in Android Studio is very different to the structure in Eclipse, and there are several files created when you start a new project which you don't get when importing a project from Eclipse (e.g. gradlew.bat, settings.gradle).
I also had this problem which can indeed be worked around with Mark's suggestion of using ./gradlew assemble.
However, this does not help you run Make Project from within Android Studio.
To do that, I had to go to Preferences / Gradle / Use local gradle distribution
and select any random (but NOT gradle) folder inside the project folder.
You might notice that this is marked as an invalid location, but you can ignore that, it seems...
Not a great solution, but it works.