I recently came across a cool project (https://code.google.com/p/android-wheel/) I would like to import to android studio. Is it possible to import this without trying to copy-paste individual code?
Thanks
you would have to extract the apk to make it easier, or if you just want to run it the apk is located in the downoads section
Those projects contains .project and .classpath files. Those are meta-data for eclipse IDE and unfortunately there is no build.gradle so it cannot be imported immediately in Android-Studio.
The best thing to do is to write a build.gradle yourself for this project and then opening it into Android-Studio. It's a good exercise to learn gradle if you are not familiar with it yet.
Related
I downloaded the Navigation Drawer demo described in the docs that is (as of this writing) available here: http://developer.android.com/shareables/training/NavigationDrawer.zip
The zip file for this project does not contain a build.gradle file and seems to use a different structure than is conventional. My guess is that this an old project but I want to build and run it in Android Studio 2.x (currently 2.2.3). Since this is part of the official documentation I guess I might be doing something wrong, or did the creator of this file intend for me to create a gradle build file on my own?
Any help for getting this running?
Whenever you import an Android project you should essentially go to menu File > New > Import Project. As a result, it will automatically create a build.gradle file in case it does not exist in the project.
I'm using Android Studio 2.3.
Hope it helps :)
Delete all gradle related files out side your app folder and import project again it will rebuild and it will include all gradle related dependencies again
Ok, so I decided to import my github project into my other machine on AS. The problem however is that AS seems to completely forget it's an Android project and treats the project as a simple directory. I can't build, rebuild or even run my project. Additionally my file structure is gone.
I've tried importing based on external models but my Android Manifest can't seem to recognize my strings resource folder either. So importing is out of the question.
Any help is appreciated thanks.
It's because you're missing a lot of the files that AndroidStudio creates with you start a new project.
A simple way to fix this will be to create a new project with the same name, package name, all that, and then just copy over your app folder.
When you reopen the project it will recognise it.
this happened to me due to that the file called build.gradle and other similar files wasn't in the root directory like when I opened my imported project I see these files :
but it should be like this :
so I navigated to the directory that contains the files in the above photos and imported that file as an android project and I succeeded, but there may other reasons for your problem , so you should clarify.
You do not have a build.gradle in the root folder of the project, maybe that is the reason.
Without the build.gradle file android studio cannot perform a correct import of the project.
I opened existing project in Android Studio.There are some missing files and I am not able to run existing project. Any help is appreciated. There is no project structure file.
It depends on how you opened the project. Typically, I would open it by selecting the build gradle project.
Check out: Android Studio: import project from Gradle
If this does not help it may be helpful to let us know what files are missing exactly. A copy/paste or screenshot of the your logs may be useful.
OK I know people have asked this problem thousands times, but Android studio is so so so hard to understand and use and I still can't find the correct way.
I find several solutions, but all of them says to copy the library codes into main project. It makes no sense to me. When I try to build a standalone project for the library, I find no "New project from existing source" like that in Eclipse.
Can I have a step-to-step for:
I have a main Android Studio project
I have an Eclipse Android library project
Without making a copy of library project
I can let the main project "use" library project
The point is, if I have many app projects using the same library source, I can just modify one copy. If I need to put library codes in every app project, it's a disaster. Eclipse can do this without any problem.
Thank you. I'm really exhausted with Android Studio, but I can't choose to stay on Eclipse since Google says ADT won't be supported anymore.
The real answer to keep your library project only in one place is in this post :
Android Studio 0.8.1 Creating Modules without copying files?
In Android Studio Project import your eclipse library project as new module. Then in Android studio right click on your app module go to module setting > select dependency tab > click plus> select module dependency > select library project module.
new Module or import Module under the project,
then open Module Settings--》Module dependencies --》‘+’ module dependencie.
I am trying to import an android project created in eclipse into android studio. This main project also refers to another library project in the same eclipse workspace. The folder structure is like this:
workspace\app1
workspace\lib1
When I import the main project into android studio, the library project is automatically imported as a sub-project (or shall we call it a module) within the main project. That's not what I want. The library project is shared by multiple apps I am maintaining. It should sit in parallel with other app projects in terms of folder structure. I wouldn't want it to go understand any particular app project.
Please help explain how I can make the library project stand its own and refer to the library project from other app projects in android project. I am fairly new to the gradle build system. So detailed instructions would be highly appreciated. Thanks a lot!
Since you are importing in android studio, I assume you are moving to gradle build system. In your case , I think, it would be best to have a separate AS project for library. Use that project to generate a jar file and then import that jar using gradle build script in each project you want to use it.
If you are sharing the same library across multiple, you can configure them as separate AS project and have "aar" file as output. (In your gradle you put>> apply plugin: 'android-library'). You then define them as dependency in your gradle file. (either through maven repo or putting it in your libs directory and defining it in your dependencies section). You can find more info at http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Library-projects
You can use version control tool such as git to synchronize the library project in every main project. But you need to use a version control tool to manage all your projects first.
Read here on "AS Modules"
review 57.1.2 on "common behavior"
Take a look at a project built on AS pattern of modules as libs used in eclipse (gradle.settings) pictured
all the includes are modules
maybe you can rethink the idea of how to get AS to work for you in reusing code....