[android] How to change target build on Android project?

I currently have an Android project in Eclipse.

I created it with a target build of 1.5 (sdk 3).

Now I want to change it so that it has a minSdk of 3 and targetSdk of 8.

To do this I see that I must build against the newest SDK (2.2)

To do this in Eclipse I right click on my project, go to properties, click on Android and change the project build target to Android 2.2 and click apply and then ok.

However this appears to have no affect and when I try it again the target build is set back at Android 1.5.

Am I missing a step or something?

This question is related to android build target

The answer is


Right click the project and click "Properties". Then select "Android" from the tree on the left. You can then select the target version on the right.

(Note as per the popular comment below, make sure your properties, classpath and project files are writable otherwise it won't work)


right click on project->properties->android->select target name --set target-- click ok


  1. 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.

  2. Edit the following elements in the AndroidManifest.xml file (it is in your project root directory)

    In this case, that will be:

    <uses-sdk android:minSdkVersion="3" />
    <uses-sdk android:targetSdkVersion="8" />
    

    Save it

  3. Rebuild your project.

    Click the Project on the menu bar, select Clean...

  4. Now, run the project again.

    Right Click Project name, move on Run as, and select Android Application

By the way, reviewing Managing Projects from Eclipse with ADT will be helpful. Especially the part called Creating an Android Project.


I had this problem too. What worked for me was to first un-check the previously selected SDK version before checking the new desired version. Then click okay.


to get sdk 29- android 10:

Click Tools > SDK Manager.

In the SDK Platforms tab, select Android 10 (29).

In the SDK Tools tab, select Android SDK Build-Tools 29 (or higher).

Click OK to begin install.


Another way on the command line if you are using ant is to use the android.bat script (Windows) or android script (Mac). It's in $SDK_DIR/tools.

If you say,

android.bat update project --path .  --target "android-8"

it will regenerate your build.xml, AndroidManifest.xml, etc.


as per 2018, the targetSdkVersion can be set up in your app/build.gradle the following way:

android {
    compileSdkVersion 26
    buildToolsVersion '27.0.3'

    defaultConfig {
       ...
       targetSdkVersion 26
    }
    ...
}

if you choose 26 as SDK target, be sure to follow https://developer.android.com/about/versions/oreo/android-8.0-migration


The file default.properties is by default read only, changing that worked for me.


Well I agree with Ryan Conrad on how to do it in eclipse, have you ensured you have changed your manifest.xml?

 <uses-sdk android:minSdkVersion="3" />
 <uses-sdk android:targetSdkVersion="8" />

As Mike way says. Change target BEFORE doing anything in your project that requires a higher target like android:installLocation="auto".


There are three ways to resolve this issue.

  1. Right click the project and click "Properties". Then select "Android" from left. You can then select the target version from right side.

  2. Right Click on Project and select "run as" , then a drop down list will be open.
    Select "Run Configuration" from Drop Down list.Then a form will be open , Select "Target" tab from "Form" and also select Android Version Api , On which you want to execute your application, it is a fastest way to check your application on different Target Version.

  3. Edit the following elements in the AndroidManifest.xml file

xml:

<uses-sdk android:minSdkVersion="3" />
<uses-sdk android:targetSdkVersion="8" />

The problem sometimes occurs when there are errors in the project.

For instance, if your project is configured with a target of 3.2 but the 3.2 libraries are not available, you will not be able to change the version to 4.0!

The usual (perhaps brutal) solution I use is to create a new project with the correct target and copy src, res and manifest into the new project.

Update:

This seems to work:

  1. Change the selected through the build properties as normal
  2. Manually edit project.properties AND default.properties to make sure they both reflect the desired target.
  3. Close the project and re-open it

I always run Android Tools | Fix Project Properties after making any changes to the build target.


You should not have multiple "uses-sdk" tags in your file. ref - docs

Use this syntax:
    <uses-sdk android:minSdkVersion="integer"
          android:targetSdkVersion="integer"
          android:maxSdkVersion="integer" />

Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to build

error: This is probably not a problem with npm. There is likely additional logging output above Module not found: Error: Can't resolve 'core-js/es6' WARNING in budgets, maximum exceeded for initial How can I change the app display name build with Flutter? Error - Android resource linking failed (AAPT2 27.0.3 Daemon #0) Still getting warning : Configuration 'compile' is obsolete and has been replaced with 'implementation' Could not find com.android.tools.build:gradle:3.0.0-alpha1 in circle ci Error:Execution failed for task ':app:compileDebugKotlin'. > Compilation error. See log for more details Component is part of the declaration of 2 modules Maven build Compilation error : Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Maven

Examples related to target

failed to find target with hash string 'android-22' How to set child process' environment variable in Makefile Input button target="_blank" isn't causing the link to load in a new window/tab If conditions in a Makefile, inside a target The project was not built since its build path is incomplete jQuery: go to URL with target="_blank" Target elements with multiple classes, within one rule What does this symbol mean in IntelliJ? (red circle on bottom-left corner of file name, with 'J' in it) Can I create links with 'target="_blank"' in Markdown? How to change target build on Android project?