I am geting an error while building android project? - android

gen folder is missing is the issue.The build patch failed .I have tried all solutions posted previously on this and no luck.
EDIT
To make it clear here is my original post
https://salesforce.stackexchange.com/questions/9460/encountering-issues-while-developing-android-hybrid-mobile-app
I am using salesforce SDK but when i am creating hello world app using native its working fine

Even if you delete the gen folder, it'll regenerate it after you compile your program.But if it is not then try creating a new project and try it again .If not , try a fresh installation of the API.

Update
Hmm, everyone in both posts is telling you to download the "SDK Platform" for "Android 2.2 (API 8)". I really, really recommend trying this. It is apparently required by the library you added to your project...
I have 4.2 and 4.1 .Is that not enough?
No, you must have the older platforms that you are building against.
Simply download it and open Project > Properties, click on Android, then select Android 2.2. After all this clean your project and save it.
Original Answer
The screenshot doesn't give us much detail, but:
Unable to Resolve target 'android-8'
Tells me that you probably don't have the SDK Platform for API 8, simply download this through the SDK Manager. Or you can change any references in your manifest and the rest of your code to use an API that you already have.

I think it is because when
you import a project, build
target is not set in the
project properties which
then default to the value
used in manifest file. and make sure you have API 8.
The solution is to enable
build target toward your
installed API level (but keep
the minimum api support as
specified in the manifest
file).

Related

Eclipse New Project

I have tried so far every solution; clean, change the namespace etc. I still cannot get this resolved.
I have created an Android project with API 19 and it creates another project alongside mine called appcompat_7. This project has quite a few erros and one of them is " article_view cannot be resolved or is not a field ".
The following files have the errors;
ArticleFragment.java
HeadlinesFragment.java
MainActivity.java
All of these files seem to have issues with R.layout.*
I am not sure what would resolve this issue at this point as this is completely new project and I have tried almost every API above 17 and each project has definitely an error that does not get resolved with clean etc. I am using Eclipse Luna and I am sure I was able to install the correct SDK.
As a note: Am I the only one who thinks this IDE for Android is somewhat messy and not friendly at all?
Thank you for any insight.
Edit:
I solved the problem by trying API 18 for both compiler and target. It did not create the appcompat_v7 project so I just fixed the dependencies and changed the namespaces. I still think Eclipse is not working well with Android plugin.
I was also stuck with the same issue few day ago,
I resolved the same issue by updating sdk to latest version 23.0.4. and extras: Android support Repository to rev. 6 Android support Library to rev. 20
first of all open up your Android sdk Manager from eclipse and download all latest sdk updates and extra downloads.
And then after downloading all updates , you have need to use a fresh Eclips editor because your existing eclipse will not let you successfully update from Android sdk tool 20 to 21.0.4 Then just use a fresh eclips editor and set up updated android sdk path in the fresh eclips (the same one you have used in your last eclipse editor , you can find it at Window>> Prefrences >> Android).
Hopefully this will solve your problem.

Android Hello World in IntelliJ 12 - Cannot find android.app.Activity class

Please see below. I have a feeling I've got the SDKs configured incorrectly, but I'm not sure how to solve it. I tried Googling for answers but no one had this exact problem.
Do I have the wrong Java version maybe? It seems like the two SDKs might be conflicting with each other.
I made this project via:
Create New Project
Android > Application Module
Defaults and Finish
Edit: See screenshot. I got it working. All I did was create a new project and re-select the Android SDK. I'm still thinking it was because I added too many SDKs/JDKs the first time. I think all you need is the Android SDK and don't need to add the normal Java one too.
I tried what for3st suggested to no avail at first, but i've heard other places that you should use JDK 1.6 for IntelliJ IDEA in other places, so you can do that here. Also, you set the SDK by going 'File'->"Project Structure" -> "Platform SettingS" -> "SDKs"
In the end, I also switched from Android 2.2 to 2.3.3 (api 10) and that got it to work. Don't have a good idea why it didn't work for 2.2, but since I just want a beginner's tutorial, I'm fine with that.
I had exactly the same problem, but the conditions leading up to it are quite unusual.
I downloaded the Android SDK as a zipfile and unextracted it into /opt.
However, the permissions did not allow normal users to enter all directories or execute all files... so when IntelliJ indexed the SDK it only picked up the res jar... and never added the sources to the library path!
Deleting the SDK, fixing the permissions problem in the SDK, and creating a new reference in IntelliJ fixed it.

Failed to instantiate com.android.menubar.internal.MenuBarEnhancerCocoa

I am new to the android development and when i create a new project using eclipse juno on mac OSx i got an error at runtime Failed to instantiate com.android.menubar.internal.MenuBarEnhancerCocoa
And yes on the layout file it also says- The project target(Android 4.1) is not properly loaded.
Anyone please help me how to get out of this. Thanks in advance..
And yes everything was setup properly SDK and all, because this whole setup is running properly on one of the other system.
I had the same problem but managed to resolve it. com.android.menubar.internal.MenuBarEnhancerCocoa - was not in the SDK that was linked to Eclipse install (I have multiple for various reasons - e.g. AppEngine not supported in latest Eclipse). There were a number of steps I had to do to resolve this (so any one of them may be the actual fix or a combination may resolve the problem).
Here's a checklist :
If you have installed Eclipse - click the Android SDK manager icon. Ensure it is pointing to the latest Android SDK (R20 as of writing)
As it's a new Eclipse+SDK - add the build targets by selecting from the list of targets that appear in the SDK manager. Also add Android support tools
Restart Eclipse. When asked about he workspace - create a new one. I thought some of my problems would be linked to old projects.
The problems should have gone away. One final thing is, once you create a project - check your certificates have not expired. There's another thread on updating the debug certificate (Delete your keystore located in ~/.android/debug.keystore then restart Eclipse.)
Create a new AVD target.
Hope those things help.
It appears to me the com.android.menubar.internal.MenuBarEnhancerCocoa is only there to make the android app feel nicer if it's run directly. Then preferences and about will be in the application menu. If you run the android sdk manager from eclipse, then eclipse will take over that part of the application menu.
Although it doesn't sort out the issue it may be useful anyway. There's the web page with the sources MenuBarEnhancer where there's the call to instantiate the com.android.menubar.internal.MenuBarEnhancerCocoa class.

Changing the min. SDK version of an Android app

How to change the version of android application. i did entire code in Android 2.2 version, if i want to install the apk in 2.1 version, it getting parse error. How to change the versions of application. I dont know how to solve this issue. pls guide me to solve this problem.
if you are using eclipse it's very easy
go in eclipse project explorer
then right click on properties
select android from tree view
select your appropriate version.
and then in
in menifest file change
minsdk to 2.1
If you are using eclipse change value in manifest and build target in project configuration (Right click on project->Properties->Android-> Select that one which you need.
You have to also know that there can be some problems because of different version.
Check also this one Android Developer

Changing Android Project SDK level

I started writing my first Android app, and chose SDK 2.0.1, before I had an android phone.
I wantto test the app on a phone that is Android 1.6. The app itself uses pretty simple stuff, so I'm sure its 1.6 compatible, but I want to change the SDK level from Eclipse.
The "default.properties" file in my project tree and naively tried to change from Android 6, but it isn't changeable, but if I try to change it it tells me to change the build.properties of the project. I don't know what that means. I'm not used to eclipse and am still fumbling around it.
I went to the project properties and clicked on "Java Build Path", but from there I don't know how to add,remove or edit the libraries.
Basically, I'm asking how to downgrade my project from inside eclipse, so I can export it to a compatible phone.
You can actually keep the project's targetSDK at the same level, and just use a minSDK value.
What this means is that your application will target to build against a certain API, but it will let phones with lesser versions of Android than that API to also run the app. The catch is that you have to make sure you don't make any API calls that don't exist in the older versions of Android.
To change this, go to your AndroidManifest.xml and add the following inside of the xml node:
<uses-sdk android:minSdkVersion="3" />
This would set your minsdk to Android 1.5. Change it 4 for Android 1.6 and so on.
But if you really want to change the TargetSDK, right click on your project --> properties. Then click the Android tab on the left. Then check the box of the target API you want to build against.
Some more versioning info can be found here.
You can change your the Build Target for your project at any time: Right-click the project in the Package Explorer, select Properties, select Android and then check the desired Project Target.
PS : I'm on Eclipse Helios
http://developer.android.com/guide/developing/eclipse-adt.html

Categories

Resources