Unable to build Eclipse library projects after ADT update - android

I have a main project (mainapp) I am developing for Android under Eclipse. It uses the facebook-android-sdk library (fblib) which is a separate Eclipse project with it's project properties checked as "Library". Under the project properties > android section for mainapp, I have fblib added as a library. everything works fine.
I needed to create a new version of mainapp which uses different database files (assets subdirectory). To do this, I created a new Eclipse project (newapp) and setup mainapp as a library under project properties > android.
Everything was working fine until the latest ADT update. I am getting errors trying to build/run newapp (Conversion to Dalvik format failed with error 1). If I go to mainapp and uncheck "Library" from project properties > android, I can build mainapp as a regular application and it seems to work just fine.
I've searched for multiple jar files in project directories, updated proguard to 4.8beta, deleted/added jars to the build path, removed exports, added exports, deleted dependencies, added "lib" directories, cleaned, restarted, rebooted and pretty much anything else google would turn up, but to no avail.
It was all working fine with ADT 16 so I'm really confused here. Has adding a library project to an application, which also incorporates a library project, become somehow deprecated? I just can't seem to get this working.

The new ADT makes you call it 'libs' instead of lib. rename your directory and see if that fixes it
Refer: http://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&groupby=&sort=&id=27490

I've also noticed in my own projects, under Java Build Path > Order and Export, I sometimes need to go in and make sure all my linked sources have their boxes checked.

I had similar issues. The issues were because of different build system introduced "Gradle".
Resolution: Forcibly open Android SDK Manager, and take update to install
1. Android SDK Build Tools revision 17
2. Android SDK platform tools revision 17
3. Android SDK tools revision 17
From all library project dont forget to enable "Android Private Libraries" the check box inside properties-> order and export.
Thanks.

Related

Facebook SDK v.4 for Android: errors on Eclipse

I am trying to import the latest version (4.0.1) of the Facebook Android SDK into eclipse but I am facing issues in having the project being properly built and imported as a Library.
I followed the steps (for android studio, ported to Eclipse) provided in the official guide and looked through Google for other developers having the same problems as I am having but I am still not able to have it properly working.
Here are the steps I do:
Download the Facebook SDK for android from here: https://developers.facebook.com/resources/facebook-android-sdk-current.zip
Extract the projects
In Eclipse, import existing Android code into workspace
Select the folder "facebook" and choose the only project that is shown (the project is properly imported)
Right click on "facebook" project, properties, android and check "isLibrary"
clean project
At this point I still have issues for annotations and classes not found from "android.support" package.
Project's setting for Java compiler is "1.6", minSDK is 9 and target is 17.
I tried also to add the facebook library to my main project but it is still not working.
I tried to put java 1.7 in the compiler but it is not resolving the missing classes plus it is saying that to compile with java 1.7 I need to have min API set to kitkat (which I don't want because I will not be able to compile for 4.2 and 4.3).
I added manually the androd support jar from the SDK Manager folder of android and this resolved partially the missing classes but some did remain.
I am using Eclipse Version: Luna Service Release 1 (4.4.1) with JDK 1.7.0_51 and the latest ADT Plugin (all android components updated with SDK Manager).
Any help is appreciated.
I did some more tests and find out that by downloading the two libraries:
android-support-v4.jar
bolts-android-1.1.2.jar
from the github project (https://github.com/facebook/facebook-android-sdk) did the trick.
So the steps are the following:
Download, unpack and import as android existing code into workspace the latest v.4 version of the Facebook SDK for Android.
Download the two jars from GitHub
Set the Facebook Project as "isLibrary"
Add the two jars as "external jars" in the classpath
Set the java compiler to 1.7
clean and rebuild the project
Now errors are gone.
Download the facebook sdk from here.
Extract the zip file.
Import only facebook sdk project into eclipse as "Existing Android code into
workspace".
Now, this project will show many errors, do not open any java file or
resource file and do not try to do any imports or clean project until I
mention it to do so.
First add the v7 library to this project by doing right click on facebook
sdk project >> properties>>android>>Add Library.(If you don't have latest
v7 support library download it from sdk manager), also set the project build
target to the maximum android version available and select "is library".
Now, right click on facebook project and select >Build path>Configure build
path>Libraries tab>Add external jars> browse to place where you extracted
facebook sdk in step 2 and find two jar files in libs folder(android-
support-v4.jar and bolts-android-1.1.2.jar) and add both files. Switch to
"order and export" tab and select both the jar files and click on ok.
Now right click on facebook sdk >>properties>>Java Complier>>set the
"compiler compliance level to 1.7 or more and use default compliance settings.
Now select the project and click on Project > Clean.
This should remove all errors now. This is how it worked for me.
Android Facebook SDK import occurs with errors - Eclipse
Check this out. May be this will help you.
I faced same problem while working in Android Studio.
But you are facing in Eclipse.

android studio new project missing folders

I have created a new project using the latest version of Android Studio (0.2.2), this is a fresh install of studio. When I am in the project explorer view, it fails to show me any folders for my project. I should see a root project folder, and within it the .idea, gradle, and module folders, but they are not showing.
Here is what I expect to see (taken from the sample project created on first boot):
But here is what I see immediately after the project's creation:
I cannot figure out how to expose my project's folders! I do not want to develop without the project explorer, it's simply too much of a hassle. Did I create the project incorrectly, or am I missing some not-so-obvious setting somewhere?
Thanks.
The problem here is that I assumed android studio would create a module for the application. I assumed this because it asked me at the beginning for app name, module name, package, sdk info etc.
This assumption turned out to be false. You must create your first module manually through File > Project Structure. After that is done, the project explorer shows the files.
File -> Project Structure -> Modules
Add Button (Green plus button) click -> New Module Select
New Module window -> "Content root" change path button click to select "Project root file path"
Apply to change save and "OK" button exit.
In the project Explorer there is a drop down menu where you have selected project, now change it to project files.
I hope this will solve your problem. reply if it didn't.
You have created a new gradle project not a new android project.
Update your android studio tools to 0.2.3 - Go to Help menu - select check for update.
then Update your android sdk tools, android support repository, android support library and android build tools using android sdk manager.
And update some configuration in project structure. Go to File menu->project structure -> in projects tab select Android SDK as default sdk and in SDKs tab set correct path to updated android sdk.
Now restart android studio and try to create a new project and it should work fine.
(Noted for posterity) I had a similar issue come up recently, when importing an Eclipse android project. The issue was that the source folder wasn't added as such. I had to manually go into Project Structure -> Modules -> Sources and make sure that the "src" folder wasn't excluded and was marked a source folder.
Although this question is asked years ago. But now following simple solution worked for me.
Clicking 'Sync Project With Gradle files' makes all directories visible.
I had this exact same issue, there are some problem if you upgrade from 0.1.9 version to 0.2.0 in Windows.
Android Studio 0.2.0 Release
The solution (which worked for me) was to completely uninstall Android Studio and reinstall the 0.2.0 version.
I had the same problem today. Additionally, the IDE posted an "Assertion Error" into its event log.
Downloading and reinstalling the preview version, then applying the patch to 0.2.6 worked for me.
Change the SDK to a level that you have installed in the SDK manager. The SDK manager can be accessed from Tools -> Android -> SDK Manager. For me, Android Studio was packaged with API Level 17 but the new project wizard tried to target API Level 18.

Updating to Android SDK Tools R22

I updated the SDK Tools to R22 and the ADT Plugin as well. Everything worked well before the update but since then, I have problems.
Basically I have 2 library projects and an app project. One of my library projects contains some jar files in the "libs" folder. One of these jars is used in the app project itself for some initial setup. Before the update, everything worked fine, but now it asks me to add the jar to the build path and even if I do so, when running the app it still gives me ClassNotFoundException.
Did anyone had some similar experience or has any idea about what causes this and how can it be fixed?
Thanks.
Check this Android Sdk tools Revision 22 issue?. "I found that I needed to check all of the boxes in the order/export tab of the Java Build Path for the project - and each library -- to properly compile and run the app on a device." - should helps.
The workaround here worked for me
OK. I also had a Simillar kind of Problem.
Like say If you have library project as google-play-services_lib before updating than might happen that your library code has been also updated after updating your SDK.
You Should Remove that library project from your Workspace and Import
again from the source
folder like in my case i had to import from /android-sdk-linux/extras/google/google_play_services/libproject/google-play-services_lib. Add reference of
your library path to you android app project. clean and build your Project.
Hope this Helps.
you should try to upgrade eclipse.
1) Get the new imports via the Android SDK Manager
2) Check for updates in the Eclipse repository: help/check for updates
That would "for real" upgrade the SDK version in your configs.
Dunno if the other steps pointed by VShcryabets are needed, i had them before.

Importing libgdx project into Eclipse Juno error Cannot find .apk

I am just starting to learn Libgdx, and am in the process of importing the 4 projects[desktop, main java game, android, html] into Eclipse Juno. I have not added any lines of code, just trying to get them to run on the different platforms.
It runs fine on the desktop version, but when I tried to run it in the Android emulator I get the error. Cannot find mygdxgame.apk!
I realized that my gen folder is completely empty, there is no R.java for the project. I have tried a number of things to make this work, but none of it is working. I am listing the things I have tried so far, and the hopefully the reason why I am asking this repeatedly asked question.
Project > Clean
Package Explorer [right click on my project] > Android Tools > Fix Project Issues
Deleted gen folder and Project > Clean
Restarted Eclipse
Deleted the project and Imported it again
Set Compiler Compliance Level to 1.6 for both main java game and Android project
Added a dummy XML to the android project and tried clean, and deleted it
Unchecked and rechecked Build Automatically
Checked my target-sdk in project.properties and made sure it is the same Project Properties -> Android and in my Manifest.xml
[Right click on project] > Properties > Java Build Path > Source tab, Removed mygdxgame/gen folder and then added it again
Made sure Project Properties > Android > Is Library is unchecked
Nothing has worked so far. My gen folder is still empty and I am unable to run the Android project because of the same error. Cannot find mygdxgame.apk!
What else can I do to fix this? In case this is answered I would appreciate someone giving me a link to the solution, as I have been pouring through SO and Google in general for nearly 2 hours now, with no success.
Regs
What happened to me a few days ago:
1.- I got the SDK Tools 22 update and I installed it, no other update appeared in my sdk manager... so I closed it.
2.- Then I got that "NO APK" error and tried every answer I could find.
3.- I opened SDK manager again, and I noted SDK Platform Tools also got an update and there was a new one: SDK Build Tools. Both of them didn't show up when I first updated the SDK Tools.. so.
ANSWER:
Open SDK Manager and check if your SDK Tools, SDK Platform Tools, SDK Build Tools are updated :)
On your build path, you should have a reference to the main project, under Projects tab of Java Build Path. Under Libraries, you should have gdx-backend-android.jar and gdx.jar along with Android not being a library.
Please check if Android is set as a library. If so, uncheck it. To do that, right click on the project and then select Properties. Choose Android on the left panel of the new window. Uncheck Is Library if checked.
Here's something might help-
Unable to run Android app, Could not find .apk issue in eclipse
I would take alook at your buildpath if all libs are correct. If it's a projekt from an other computer the libs are often at different places so you need to correct those manual. If they are not correct the android projekt do not generate your R. class and so on. So do rightclick on the core projekt -> Buidl Path -> Configure Build Path. Now take a look at the libs if all are there. I had the same issue with the android 15 apk so i need to add it manual. The clean or such do not fix such because eclipse can't know where you have all your libs.
If you really dont get it run i would recoment to use the setup ui of libgdx. It does noramlly handle all imports and so on for you. You can also use it to update your current projekt and so on.
Else i would read the guide for Manual Project Setup of Libgdx.
Libgdx setup Guide
I hope this does fix it.

Android ActionBarSherlock on NetBeans - working but editor showing errors

I'm using NetBeans for android application. I installed properly (I think) ActionBarSherlock package as android library project. Everything works fine, I can build and run application, but code editor doesn't recognize ABS classes (just look at screenshot, BUILD SUCCESSFUL but errors exists) and code completion doesn't work too.
My configuration:
Stable NetBeans 7.2 with android plugin ver. 1.13
Linux Mint 13 Maya 64 bit, Mate
ActionBarSherlock ver 4.2 (stable)
How I installed ABS:
Download and extract source
From sdk/tools run command:
./android update project -p path_to_ActionBarSherlock/library/
Similar command to connect android project library with my test project (there is similar option in Netbeans IDE but I get error that this is not android library project)
./android update project -l path_to_ActionBarSherlock/library/ -p path_to_my_test_project
I have tried clean and build on both projects but no results. Any idea?
Regards
The way I finally managed to add ActionBarSherlock to my android project on Netbeans was to:
Download the latest version of ActionBarSherlock and unzip it
Go to the subfolder called library and remove the pom.xml file from there (with one of the previous versions it didn't work. I had to first build it, close it and remove not only pom.xml but also some netbeans properties files)
Open that subproject (library) in the Netbeans
Now this project will no longer be seen as a maven project. Netbeans will see it as an Android project. Then I:
Clean&build it
Add it to my-project's library properties (right-click on my-project, properties, library, add, point the proper location of library project). Important here was to copy/move that library project somewhere near my-project. Otherwise it claimed that it cannot open it.
And from now on it works fine.
Key to that thinking was that Netbeans didn't want to add the provided library project cause it saw it as a Maven project. When the pom is deleted, Netbeans no longer sees it as Maven project nut as an Android project and it can without any objections add it as an Android's project library.
Probably there are better solutions, but I didn't find any and that was the only one working for me.
Hope it helps.
You can also make a new Android project, and then copy and paste the needed files in the new project.
So only copy:
libs, res, src, AndroidManifest.xml

Categories

Resources