I'm trying to re-compile android app from sources using Eclipse STS. I added the sources to plain new project. I ended up with missing dependencies for classes from android.* package.
To solve this, I decided to locate android SDK on my disk drive and use the Project properties -> Java Build Path -> Source -> Link source. There I selected path to the android SDK.
But this would produce lots of build errors for missing types, such as
The import android.databinding.testapp.databinding cannot be resolved
I think what I did is not the correct way to include the SDK anyway.
What is the correct way to compile your Java code that uses Android SDK?
In case you would like to continue to use Eclipse/STS for Android development, you could give Andmore a try: https://projects.eclipse.org/projects/tools.andmore
Try to download it from kickass torrent. After that go to your project -> right button -> properties -> android, and select the path where you have saved the android sdk.
Related
I've created a simple library to get JSON responses and map it to Java Object.
I built a JAR using 'build with dependencies' in IntelliJ IDEA with JDK 1.8. However, this JAR works when used with other IntelliJ IDEA projects.
However when I add in Android Studio Project, I get this Error:com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
I found on Reddit that some user did the same (built JAR with IntelliJ Idea and Imported in Android Studio)
I think I am missing something or a way to create JAR file which is causing incompatibility to Android Studio. I'm pounding my head for hours with no luck.
For Android Studio, change File -> Project Structure -> SDK Location -> JDK Location to jdk1.7.x. For the command line, ensure java -version outputs java version "1.7.x".
I have the Android SDK witch include eclipse. Its working for developing android apps, but now I want to make a tool app for pc and I need some of the java standard libraries that where not included with the Android sdk, for example javax.imageio.imageio.
Where can I get these libraries ?
I know there is a src.zip file with all the source code from java standard libraries in the Java directory, but Is there not a jar file or something like that so i can just include it as an external library ?
This worked for me !
Go to the Build Path settings in the project properties.
Remove the JRE System Library
Add it back; Select "Add Library" and select the JRE System Library.
Found this solution here.
You should edit your build.gradle file. There is a dependency section in there.
I'm a bit confused between 2 screen in eclipse:
I'm not sure how to import FB sd into my Android project properly.
What does "android" mean vs "Java build path" ?
As current configuration I get this error:
As the error says - there are 2 versions of a jar - android-support-v4.jar. Either make FB use your version of android-support-v4 or use FB's version of android-support-v4.jar in your project. The jar will be in project-name/libs folder.
First import it as a project into your eclipse and then give its reference to your project as you have shown in your first screen. If you have only jars file then add those jar to your libs folder and then follow steps of add to build path.
Delete the android-support-v4.jar from your project as there will be a jar mismatch.As you have added Facebook SDK as a library project, it is again not required to add that support jar file.Facebook SDK already contain that library.If android-support-v4.jar is a older one then you can update it.
You have 2 android support library with different keys.
Right click on your FacebokSDK and project ---> Android tools ---> Add support Library
I don't quite understand the problem, the picture is too small, also, Facebook has a great tutorial about how to do just that, also, make sure you're using Facebook's android support jar.
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.
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).