How to run android project cloned from github using android studio - java

I cloned a project from GitHub using Android studio and I tried to run it, but I get the following error when trying to run it:
This should be able to run as I was the one that made it and uploaded it to GitHub. I just couldn't figure out how to use GitHub so I decided to clone the entire project back on my computer and it wouldn't run. It's actually also one of the templates from Android studio.
I tried looking online and I saw posts mentioning options along the lines of "syncing project with gradle", but I can't find that option anywhere in Android studio.
Not sure if this adds more information but in my original project that works and runs, it is able to show the design of the app but in the cloned version it doesn't show any of that, just code.

Resync Gradle is in File->Sync project with Gradle Files.
Has the project been pulled? Have you checked the project for errors? Do a build and see what errors there are.
My guess is there is stuff in the project (i.e. libraries) that do not exist anymore in the version of Android Studio you are using. Maybe the project was created with an old version of android studio. Also, check the Gradle app file and see if there are any problems.

Related

Flutter+Android Studio: Can't resolve Java symbols from external libraries

I'm trying to build a Flutter app that also runs custom Java code, so that I can execute code in the background, set alarms etc. As such, I'd like to access Firebase from Java.
I've created a new Flutter project in Android Studio and added Firebase as documented here (manually).
It compiles and runs fine on the device, but it seems that the dependency .jars from Gradle are not picked up in Android Studio, and as a result my Java source files show a lot of errors - source being "cannot resolve symbol 'google'" in the import statements.
Is there anything special that I need to do in order to have Android Studio pick up external Java dependencies from Gradle in Flutter application projects? I'm running Android Studio 3.0 Beta 7.
I have the same issue and would love to find the solution. I tried directly downloading the .aar file and using this guide but it did not work either.
https://github.com/yushulx/flutter-android-aar
Edit: I found an open issue on the topic which can be found here. Clearly you have found it, but in case anyone else is looking for more information about this.
Edit 2: Here is a workaround.

How can I convert an android project originally coded in IDEA or Eclipse to Android Studio and add Gradle?

I want to take on a sound recorder project from github: https://github.com/avipars/Android-SoundRecorder
But, it came from IDEA or Eclipse. I tried importing it through github, which didn't work. Then, I downloaded the ZIP and put it in android studio without much luck.
Android Studio won't recognize the file system and I want to get gradle working too.
So, how can I get it in Android Studio with Gradle working?
To clarify, I can get the project in Android Studio. It just won't compile.
Download the project in .zip form, then extract to your preferred workspace.
It looks like the project relies on two external libraries:
android.library.reference.1=../../android-libs/ListViewAnimations/library
android.library.reference.2=../../android-libs/UndoBar/library
Obviously, Android Studio won't know about these libraries while importing this project alone. Remove the above lines from project.properties and add them later into your Android Studio project as dependencies or modules (if you can find them). Otherwise, you can work out the dependencies in the code after importing.
Once you have removed those lines, from Android Studio, you can select "Import project"
Follow the import wizard and you should be brought into Android Studio with a summary of the import result. From there you can muck with .git stuff and add back in any third party libraries that this source code may rely on.
Hope that helps!

No Android project type available in Eclipse->File->New-Project

I have installed latest JDK and ADT bundle package (I'm working under Windows 7, 32 bits OS)
I installed all the possibly needed packages in ADT Manager.
I defined ADT location in Eclipse->Window->Preferences->Android
But I still have no option to start File->New->Project->Android->Android Project or
File->New->Other->Android Project
I have many other options like:
Android Activity
Android Application Project
Android Icon Set
Android Object
Android Project from Existing Code
Android Sample Project
Android test Project
etc..
But all these are not what I need.
I already looked on existing questions here like No Android project type in Eclipse->File->New-Project and others and also on several similar questions on other forums but still did not found an answer for my problem.
You have Android Application Project. What exactly do you think Android Project is? You are trying to create an applicaiton, correct? Then Android Application Project is what you want.
There is no "Android Project" option. In fact, I've never seen it. Basically, you have the following:
Android Activity - you just want to create an activity
Android Application Project - This creates a complete android application project to create an application that you can install and launch on an android device.
Android Project from Existing Code - import existing code into an Android Project
There are many more as you found out. But, most of the time, you would use Android Application Project.
You don't really specify what it is you are looking at creating specifically, so I'm going to assume this is what you want.
If you could give more information as to exactly what you think "Android Project" is for and what you are trying to accomplish with it, that would help.
Per the ADT tutorial site, they have the instructions on creating an Android Project, which is generic. There are numerous types of Android Project, with the Android Application Project being one of them. Not sure if this is where you are getting the name "Android Project" from or not. Here is the link: http://developer.android.com/training/basics/firstapp/creating-project.html
Everything you state at this point shows you have installed ADT correctly and it's integrated properly with Eclipse.

Can we use Android studio for AOSP development?

Can we use Android studio for AOSP(Android Open Source Project) development, is there a way to do it. I didnt find one. anybody got any idea on this please ?
You can use Android Studio as a IDE for AOSP, since it's just a modified version of InteliJ's IDE.
from AOSP root:
make idegen && development/tools/idegen/idegen.sh
Then just "Open Project" in Android Studio and select the android.ipr it generated.
To import AOSP source in Android Studio or Eclipse, follow the full instructions here :
https://android.googlesource.com/platform/development/+/master/tools/idegen/README
What Pedlar suggested above is one way of doing it. I ran into lot of Jar dependency issues when I tried it with IDEA community edition (Android Studio is a fork of IDEA IDE). The IDE keeps prompting you about duplicate jars etc. The generated project includes framework Java sources as well as App sources. I tried to build an App project which resulted in broken AOSP build. IMHO, IDEA is a great IDE for Java development. But didn't work well with AOSP.
What worked for me is using eclipse to browse/edit/debug framework sources, but build the code from a terminal window. To avoid AOSP build breaks, please create a shadow dir of AOSP (i.e. lndir of AOSP) and use shadow dir for eclipse project.
This is explained at Using eclipse to browse/edit AOSP link in step by step.
If you are working on AOSP, you might want to check Debugging Android framework services.

Android Project with ActionBarSherlock doesn't get built

I implemented the current version of ActionBarSherlock to my Android Project.
Everything works fine and I don't get any errors.
But when I try to debug or export my project I don't get an .apk-file out of my project. Just a .jar-file with the name of my project.
I've read about some problems the SDK had with building projects that contain external libraries but this was at SDK version 14 and so I hope, this bug is fixed...
So there might be another cause for this problem.
Does anybody know a possible solution?
You cannot get *.jar file as the result of building Android project. This seems very strange to me. There must be something wrong with your project settings (if you changed them), or the project you build is of the wrong type (i.e. it is Java Application instead of Android Application).
You didn't mention which IDE do you use, but I assume you use Eclipse.
Make sure you have installed Android SDK and Eclipse ADT correctly (just in case).
Next thing to try is to create a new Android Application project from existing sources (there should be such option during the process of creation).

Categories

Resources