I'm developing Android apps without Eclipse or Android Studio. I use Lazarus+ZenGL (Object Pascal) to build a library loaded into a "fake" project.
All is working well, also Google Play Services for admob. If I need native calls, I can add these into the mainActivity.java file.
So I haven't an Eclipse project neither for Android Studio and I need to do everything (about compiling and building apk) by command line. This is not a big problem: a batch file does everything I need: aapt, javac, dx, android update, ant release, jarsigner and zipalign.
About Google Play Services I copied google-play-services.jar into my libs directory and updated project.properties with the right path:
...
android.library.reference.1=../../../../Android/sdk/extras/google/google_play_services/libproject/google-play-services_lib
...
The problem is that Google Play Services has his own jar, that I pass also into javac options, but BaseGameUtils has not.
I tried to follow tutorials, but no one explain how to add BaseGameUtils (and libs without jar) to a project by command line (updating project.properties with BaseGameUtils is not enough).
Without this lib I can't "import com.google.example.games.basegameutils.BaseGameActivity;" into mainActivity.java
I hope this is clear enough, I'm quite new about android dev and I'm using a very alternative way...
Thank you in advance!
Related
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!
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'm trying to make a cross-platform project using C++ on Windows and the Android NDK. I've been trying to put it together in one project with multiple build configurations, but I'm running into a problem for the Android build.
My project directory structure is as follows:
PROJECT/
src <- This has the Android SDK files
jni <- This has the Android NDK files
src-mp <- Multiplatform C++ code
src-pc <- Windows-specific code
gen
res
...
When building for Android, the src-pc folder contains code that doesn't compile and generates errors (it's using GLFW and GLEW, which doesn't seem to be compatible with Android). I right-clicked on it and hit
"Resource Configurations -> Exclude from Build".
However, the errors in src-pc are still being reported and so Eclipse refuses to run the application. I know the application runs on Android without the src-pc folder.
I suspect it's something with the indexer, but I can't get it to ignore the files in the src-pc folder. I've considered setting up a separate dependent project for Windows, but I was hoping that there was a way to put it all in one project. I've looked at the resource filters functionality, but I don't see a way to set filters for specific build configurations, so that doesn't help.
I already found that it's possible to delete the problem reports in the Problems tab, but doing that every time I build is a nuisance and I was hoping for a better fix.
I'm using Android NDK R9D and the SDK tools for API level 19. I'm on Eclipse Kepler. The toolchain being used for C++ compilation is Cygwin GCC with the Android Builder.
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).