Library Projects support? - android

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.

Related

Mono.Zeroconf NuGet package will not install in Xamarin

I am using Xamarin 6.3 on a mac. I am very new to Xamarin.
I have a project open. I choose "Project" -> "Add NeGet Projects..."
I type "Mono" in the search box, and check the box next for Mono.Zeroconf, then choose "Add Package"
There are several lines of output, but the last line is:
Could not install package 'Mono.Zeroconf 0.9.0'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v4.4', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
I have tried changing the version of my android package, but each one results in failure.
Thanks in advance for any assistance
This project doesn't support Xamarin.Android as it only contains libraries for desktop .NET 2.0. This library would need to support the MonoAndroid target or a PCL/dotnet standard target.
Sadly this library hasn't been updated since 2011 it looks like! Thus it is very unlikely it will support Xamarin.Android unless it's updated in the future.
Source:
https://github.com/mono/Mono.Zeroconf

How to get IntelliJ IDEA 14 working with Scala on Android (SBT)

I'm using android-sdk-plugin to make Android apps with Scala using SBT. This generally works great - however when trying to import the project into IntelliJ IDEA 14.1 the imported project looks rather empty and does not recognize my source files as being part of the project.
The documentation says:
IntelliJ 14 now includes native support for importing projects from android-sdk-plugin. The process generally works well, however there are still several caveats:
The idea-sbt-plugin is still required to actually perform the build (no longer necessary as of IDEA 14.1)
Cloning and importing even the simplest example project results in an empty IDE not showing any sources at all:
I have installed both the Scala plug-in and the SBT plug-in (which I believe should no longer be required) as requested by the documentation.
What essential step am I missing?
Edit: I added the plug-in manually to project/plugins.sbt, then ran gen-android to get a project/build.scala containing object Build extends android.AutoBuild.
The essential step missing is the Android plug-in of IDEA. This might seem obvious but in contrast to plug-ins for other frameworks this one does not just provide extra goodies but is actually essential for anything Android.
Having the plug-in installed allows for selecting Android as a Project SDK (which not just selects an Android SDK but also a Java SDK to go with it).

NoClassDefFoundError with Mapsforge 0.4.0 and Eclipse

I am trying to add a map view to my application using Mapsforge. I have done the following:
Downloaded jar files and placed them in the libs/ folder
mapsforge-core-0.4.0.jar
mapsforge-map-0.4.0.jar
mapsforge-map-android-0.4.0.jar
mapsforge-map-reader-0.4.0.jar
Right-clicked file and selected Build Path > Add to Build Path.
In Project Properties, marked the four jars as exported.
However, when I run my app, it crashes on the first call to a class from the library:
E/AndroidRuntime(21265): java.lang.NoClassDefFoundError: org.mapsforge.map.android.graphics.AndroidGraphicFactory
Android SDK tools are all above version 17. No Maven involved.
I've been searching for an answer, but to no avail. I've tried moving the jars up in the list, cleaning the project – this and the things I did already are the essence of what's being suggested on the net. Nothing helped.
When I examine the contents of bin/dexedLibs, I notice that jars for mapsforge were created but are virtually empty, except for the manifest file and (in the case of the maps jar) the osmarender resources. Notably, the classes.dex file is absent. The Android support library in that folder contains a classes.dex file.
Any clues?
EDIT: I examined the original jar files. When looking at the .class files, I noticed each of them starts with CA FE BA BE 00 00 00 33, i.e. is in Java 7 format.
According to some of the information I found on the net, Java 7 is not supported by Android SDK. Is that still the case? This would explain why nothing works but would make me wonder why the Mapsforge devs would use Java 7 to compile a jar that is to be used with Android...
NoClassDefFound is really a hard Exception to solve,a workaround you can try.
workaroud: Java Build Path -> Oeder and Export -> make sur 3rd.jar above yourPath/src
I know android support java7, only when you use the version above 19.
#Ninja pointed me in the right direction but I'll post the detailed steps here.
Short answer: You need version 19 or higher of the Android toolchain, as that version introduced the Java 7 support needed to build against the prebuilt Mapsforge 0.4.0 libraries.
How to update:
Start ADT. Update all installed packages and additionally select at least one version of Android SDK Build-tools that is 19 or higher. (You can have multiple versions of the Android SDK Build-tools installed alongside each other.)
Now open Eclipse and select Help > Check for Updates from the menu.
If you get an error message that no software sources are available, go to Help > Install new software. In the dialog, click Add and add a new repository named ADT Plugin, URL https://dl-ssl.google.com/android/eclipse/. Then retry.
Restart Eclipse when prompted to do so.
Setting the compiler compliance level turned out not to be necessary in my case (I left it at 1.6).
With these steps my Mapsforge project works – I can display a map and the NoClassDefFoundError is gone.

Unable to compile Android Source code (cloned from Git)

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.

Unable to find package com.google.cast

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.

Categories

Resources