I'm facing a very serious problem. I've cloned a git repository from https://android.googlesource.com and can successfully import a project in eclipse (say, platform/packages/apps/Contacts). But, the project shows a large number of errors due to Private Android classes being referred by the source code. I need to have a compiled version of the source code by any means.
Does any one have an idea on how to solve this issue? Any kind of help is greatly appreciated
Try these steps:
1) Clean your project.
2) Check your projects build target. Right click your project , go to properties > Android and make sure the appropriate android API is checked.
3) If the imported project uses Google APIs, make sure you have Google APIs installed and your project build target is set to it.
Related
Hey I am trying to build an android application regarding google adsense.
I want to import the android sample.
https://github.com/Ishaan-Kumar/googleads-adsense-examples
Since I am only interested in android I want to import only this.
https://github.com/Ishaan-Kumar/googleads-adsense-examples/tree/master/android
I tried to import via VCS in android studio by url https://github.com/Ishaan-Kumar/googleads-adsense-examples.git
But it imported the whole project including all the platforms(PHP,dontnet,ruby).
The thing is I want the android only plus the android files are not detected (I think there is not gradle file in here)
How do I overcome this problem?
Often programmers explain that in there Git Page, some time don't explain. like it
Many way to import Github project into your android studio project like this ways
use zip git file Like this Step Answer [here]
use clone or git in android studio See this
use JitPack site for better performance and jump filters can help you
But
some programmers in Github don't like customizing them project
they try to damage files or redirecting for block modify
Step 1: Download Zip. Don't Fork the project or use git command or VCS in android studio.
Step 2: Open Android Studio->New Project->Open->Select android directory.
Step 3: Android Studio tells you this is a eclipse project (Convert it to gradle blah blah). Hit Next. This is the time I came to know this is an eclipse project and why android studio is not detecting it.
Step 4: Done.
PS: Thanks to comments(Comment Author has deleted his comment).
I recently updated ADT to point to Google APIs 18. The install went fine it seems and I'm able to point my Project Properties to Google APIs 18, however, Eclipse can't find the package com.google.cast. Anyone else having this problem?
That's because com.google.cast is not part of Android.
Near as I can tell, you will need to download a ZIP file containing their library project, import it into your IDE, mark it as actually being a library project, then attach that library project to your app.
Actually using those APIs appears to require a whitelisting, and it is in violation of their license to actually distribute an app (or, near as I can tell, source code) without express written permission of Google.
CommonsWare is correct, additionally, you'll need the v18 Android Support Libraries. v7/mediaRouter & v7/appCompat
I finally got this to work for me. Originally, I tried doing it like I used ActionBarSherlock (making it a library, went to Project -> Properties and told it to use that library, etc) but that didn't work. Finally, I got frustrated and simply moved the GoogleCastSdkAndroid-1.0.0.jar file from the lib folder of the library directly into the lib folder of the project.
So, again, I imported from existing code the SDK into my workspace, then took the jar file from its library and put it directly into my project's lib folder. Not sure if that's how it's supposed to be, but the sample TicTacToe game is now error free and runs on my Nexus 4.
It sounds like you're trying to run one of the Google Cast sample apps without having installed the Google Cast SDK. The instructions for installing the SDK and all necessary support libraries were just uploaded here on GitHub. I'm quoting below the relevant section for installing the Cast SDK itself:
http://developer.android.com/tools/support-library/setup.html#libs-with-res
You can either add the Cast SDK as a library project in your workspace, or add
the GoogleCastSdkAndroid-x.x.x.jar directly to the project you're building. The
former is recommended if you have multiple Cast-related projects in your
workspace.
As a library project: Follow the Support Library setup instructions linked
above for your downloaded and extracted SDK.
As an included library:
Copy the /libs folder from your downloaded SDK to your Cast-related project.
In the Package Explorer window, open (your Cast project)/libs and right
click on GoogleCastSdkAndroid-x.x.x.jar. Select Build Path->Add to Build
Path.
I have an Android Apps (A) project that depends on a Library project (B). The library project contains code as well as third-party jar files and some other jars that were exported from projects C and D. In Eclipse, I have project B specified as a library project.
However, when I connect my device and run project A (Run As -> Android Application), it crashes on the device and when I examine the LogCat output, there is a NoClassDefFoundError exception for one of the classes that exists in the jar files of project C.
When I unpack the B.jar file in Project B's bin folder, it does not contain anything else besides the META-INF/ folder with an empty MANIFEST.MF file. So this indicates that something seems to be going wrong someplace, but I'm unable to figure it out.
Could anybody help me with this issue?
Are you working with the latest ADT plugin and SDK revision? That is rev 22.x. If so there has been an important change to the dependency management.
Possible solution
For some reason the contents of the Order and Export tab has completely changed and you now have to export the Android Private Libraries from your library projects. See screenshot below:
More details
The tricky part of this change is that your project still compiles properly in Eclipse so you're not aware of any issues. Until you deploy the app on an emulator or device and you get the ClassDefNotFoundException on any call of a library project.
Not confirmed but I believe this is related to recent changes for maven support, also related to android studio preview
Similar change in the past
This reminds me of a similar change in the update to rev 17 where the lib folder suddenly changed to libs and all content from the original lib folder wasn't packaged so you wouldn't see any issues in eclipse. Only once installed on a device.
More information that 'issue' is available on this link. If you search on stackoverflow for "sdk 17" and "classdefnotfound' you'll also get enoug questions about that change.
I was only able to find guides on how to import an Eclipse project into Android Studio. But I am not using Eclipse, I am using IntelliJ IDEA.
How do I generate the new Gradle build files for my project?
EDIT:
To clarify. I know how to setup Gradle manually. But that's not what I am asking for. The question is: Am I able to let the Android SDK generate the Gradle files for me? Like the ADT does... But since I'm not using Eclipse, I don't have access to the export feature of ADT!
Have you started Android Studio yet? Because importing IDEA Projects is one of the possible selections you can choose in the beginning.
If you passed that initial state already, just go to File -> Import Project and select the folder of your project that you want to import. The rest is straight forward and pretty bullet proof as both are basically IDEA :D
Okay for everyone who needs to do this:
It's not possible.
But if you want to create the neccessary Gradle build file manually. Here it is: https://gist.github.com/Goddchen/5600345
You need to "Import Project (Maven, Gradle, ...)" and then select not the folder, but 'settings.gradle' instead. Then Android Studio will do everything by itself.
I have been trying to work with a Library Project, just like it's mentioned in the documentation :
http://developer.android.com/guide/developing/eclipse-adt.html
I have created my Library Project as a Android 1.6 Project and now I have been trying to reference to it out of my second project (also an Android 1.6 project) and I am getting the following error :
"Target 'Android 1.6' does not support building project with libraries."
"ERROR: Unknown option '--auto-add-overlay'"
The documentation states that supported platfroms are the 1.5 onwards (with exception for the 2.0 & 2.0.1) and that the second project should have the same platform or higher (in my case the same)...
So any idea what's ahppening here ? And most importantly : any idea how to solve this ?
Thx in advance !
How is the library project compiled as? is it a jar file? And in eclipse, did you add it in Eclipse as "Project Name" -> Right click -> Configure build path -> Libraries. Click on Add External jars and add your jar file.
First of all to reiterate what was said in the previous comment..
A "Library Project" in Android terms is not just a dependent project or an external jar. It is an Android concept introduced by the Android team see below...
http://developer.android.com/guide/developing/eclipse-adt.html
Tiger, have you found a workaround to this yet?
I'm having exactly the same issue and after battling with this for a while now I'm pretty sure it's a bug (but this particular bug is quite old and might just look very similar) Have a look at:
http://code.google.com/p/android/issues/detail?id=8498
Yes, it appears that certain SDK levels in Linux aren't supporting the "--auto-add-overlay" option required when using libraries in Eclipse. I've found that 1.6 works find, as does 2.1-update1, but 2.0 fails. I ended up changing my app to rely on 2.1 instead of 2.0 and it worked.