Unable to open cordova project in eclipse - android

I try to import my cordova ionic project to eclipse as an existing android application but it was undetectable? Any idea why? I could run my app in android phnoe using 'ionic run android' but why it can be imported to eclipse?
I also installed android studio and it has the same problem. I don't have a clue why is this happens..

Remove all CordovaLib that exists inside eclipse and import it again. It works 100% most of the time. Second time you import the project you will enable import your project with CordovaLib. It happens because there are existing CordovaLib inside your eclipse.

You have to choose the platforms/android folder when you want to import in eclipse, not the root of your project.
Eclipse only knows the android project, but not the cordova project.
And then select both your app and the CordovaLib projects.
But be aware that changes made in /www will only take effect in eclipse after you rebuid the project.
Or you can use eclipse project properties to unhide assets/www an in that case be aware that any changes in assets/www will be lost if you use the cli to build your project (and the same goes for any change in platform/android).
That's why I only use eclipse when I need to debug (mostly for plugins).

I faced a very same issue,
Please make sure - you are importing the project using already existing android code under the Android tab in import option. Not with already existing project option in general. This one fixed my issue,
Hopes this one will help some to save some valuable time ...

Related

Android Studio cannot detect project structure of a flutter project

Initially, I was looking why I could not open the emulator window, then I found out that the main reason for that was that android studio cannot detect flutter project structure automatically, due to the missing ".iml" files and ".idea" folder, due to which it does not know the existence of two modules i.e my_project and my_project_android.
Can anyone help me? Why is this happening?
Note:- Android studio can detect flutter project structure just fine if I create a project from my computer only, but since I am importing a project from GitHub, it cannot detect the appropriate project structure.
Below is how my modules section in the project structure looks, everything section is completely empty here.
Edit 1:-
Following are the picks on trying to import project inside modules
Edit 2:-
This is from where I import project directly from android studio using "Get from Version Control" than,
After this, I just click on clone and no more settings are asked(or required).
I found out that the project I was getting from VCS was flawed, it had gradle files in the flutter root folder and some more problems, eventually, I created a new flutter project after that I copied dart and other files and also updated some android files, and it worked.

GitHub Project not pulling in Android Studio

I was trying to pull a GitHub project into Android Studio and it get struck while proceeding through import project from gradle with default settings and takes infinite time to load.
Here are a re few things to try:
There are several settings you can change in the AndroidStudio repo import function. Try changing the settings on the gradle import.
If you can't get the Android Studio import to work, try using another way to pull your project. You can use the command line or SourceTree. Once you have made a local copy, you can open the project with Android Studio. That has worked for me in the past.

How to Create Android app

I created my project in cordova and its here
enter image description here
Here problem is i cant use cordova build function (it isnt work for me)
and now question is here :
can i compile it and make apk file from these files???
if yes how?
i have android studio installed but i dont know how to use it
same as answer by Jackowski.
but,Make sure you import the "platform/android" directory underneath your cordova project (and you want to Import Project, not Open Project).
http://codeofandroid.blogspot.in/2016/02/import-cordova-project-in-android-studio.html
Open Android Studio and select 'Import project' option. Then select your project location and you are ready to use Android Studio with your project.
More info at: https://cordova.apache.org/docs/en/5.0.0/guide/platforms/android/

Importing and converting Eclipse-made Android project from Github to Android Studio Gradle-build

I'm trying to migrate from using Eclipse for my Android-project to the new Android Studio, and I'm having an issue related to Gradle.
What I want is for me to push the latest Eclipse-build to Github, and then be able to pull it down in Android Studio, having the latter automatically convert the project to a Gradle-build. If I'm reading the documentation right, the Android Studio import is supposedly able to do this.
When importing, I can choose between "Create project from exisiting sources" or "Import project from external model"
If I choose the first option, the project won't use Gradle (as far as I can see). If I choose the second, it seems to be looking for an already existing gradle buildfile "build.gradle" in my project.
So - Should I download a Gradle-plugin to Eclipse and make a gradle build-file there, or am I doing something wrong in the import?
It seems the only other questions I can find on SO is about importing and Eclipse export or simply how to pull a project from Github in Android Studio.
Thanks :-)
Importing and converting an existing Eclipse project into a Android Studio Gradle project is quite simple :
File -> Import Project (in Android Studio)
Select the manifest of your Eclipse Android project.
Done.
There may be some dependacy management to deal with.
You can also take a look here :
How do you import an Eclipse project into Android Studio now?
How about this:
clone repo to location 1
export from eclipse
import to android studio in location 2
copy the .hg files or whatever's applicable from 1 to 2
commit from location 2 including deleting eclipse files
Now the repo will have the android studio project and not eclipse.

Phonegap_java: duplicate class: org.apache.cordova.BuildConfig

I have downloaded Phonegap from CLI (working on windows7) and made a project from command line
phonegap create hello com.example.hello HelloWorld
and built it
phonegap build android
When i import project (project/platforms/android) in Intelijj and try to build it, it gives me this error
java: duplicate class: org.apache.cordova.BuildConfig
Any advice?
The steps that I did to import project in IntelliJ, after I built the application with "cordova build":
Import project
select "PROJECT_FOLDER/platforms"
Import project from external model "Eclipse"
In select Eclipse project, select all.
Import JDK and SDK (JDK 1.7 and SDK Android API 17 and 19 in my case)
Import Android Dependencies From Property Files (Add dependency helloworls --> helloworld-cordovaLib) OK.
At last this build and run without problem to me.
There are an issue with IntelliJ and Maven, maybe you can apply the same solution.
http://youtrack.jetbrains.com/issue/IDEA-94901
1.) Delete the "gen", "target" and "out" folders
2.) Revert the changes within the "ipr" and "iml" files
3.) Start IntelliJ 11.1.5 EAP / 12 EAP
4.) Open the pom file
5.) Right click -> "Maven" -> "Reimport"
6.) "Build" -> "Rebuild project"
A better workaround (tl;dr): Don't do the 'cordova build' step from the Cordova workflow (Getting Started Guide for Android)
We ran into this issue while doing Cordova training for our students. The recommended tool from developer.android.com switched from the Eclipse ADT Bundle to Android Studio, so we made the switch.
Unfortunately, you can't follow the same workflow. The Cordova 'Getting Started' guide for the Android platform spells out the commands to execute from the command line. But, they are for the Eclipse platform. One step needs to omitted for it to work with Android Studio.
One of the links above (http://www.tricedesigns.com/2013/05/16/phonegap-android-studio/) shows the correct workflow, but if you're used to the Cordova workflow, you may just assume it's the same and complete the steps in the same way. However! Omit the 'cordova build' step. Building the project (instead of letting Android Studio build it) causes Android Studio to get the error from the question.
The accepted answer above didn't work for us, because when we attempt to import the project, there is no 'Import project from external model "Eclipse"' option. This, however, worked just fine. Hope this saves you the hours we spent looking for answers/troubleshooting.

Categories

Resources