Android Studio:失败[INSTALL_FAILED_OLDER_SDK]

时间:2021-12-19 17:03:43

Today I have downloaded Android Studio v 0.8.0 beta. I am trying to test my app on SDK 17 . Android studio error Failure [INSTALL_FAILED_OLDER_SDK] Here is my android manifest

今天我下载了Android Studio v0.8.0测试版。我正在试着在SDK 17上测试我的应用程序。Android studio错误失败(INSTALL_FAILED_OLDER_SDK)是我的Android清单。

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.vahe_muradyan.notes" >
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".Main_Activity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

It seems that android studio uses configurations in build.gradle.Here is build.gradle

android studio似乎使用了build.gradle的配置。这是build.gradle

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 'L'
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.vahe_muradyan.notes"
        minSdkVersion 8
        targetSdkVersion 'L'
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.+'
}

24 个解决方案

#1


27  

There are my config to support L and old versions of android:

有我的配置支持L和旧版本的android:

apply plugin: 'com.android.application'

android {
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.example.uladzimir_klyshevich.myapplication"
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }


    productFlavors {
        l {
            minSdkVersion 'android-L'
            targetSdkVersion 'android-L'
            compileSdkVersion 'android-L'
        }
        old {
            minSdkVersion 10
            targetSdkVersion 20
            //TODO comment second line if build is not compiles for "L"
            compileSdkVersion 20
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    lCompile 'com.android.support:appcompat-v7:21.+'
    oldCompile 'com.android.support:appcompat-v7:19.1.0'
}

As result you will have flavors:

因此你会有不同的口味:

oldDebug
oldRelease
lDebug
lRelease

And can install your application on old versions of android.

并且可以在旧版本的android上安装您的应用程序。

#2


12  

Do those changes in build.gradle file in the wear module

在构建过程中进行这些更改。磨损模块的分级文件。

compileSdkVersion 20
targetSdkVersion 20

So the final wear/build.gradle content will be:

所以最终穿/构建。gradle内容将:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "your package name"
        minSdkVersion 20
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.support:wearable:+'
    compile 'com.google.android.gms:play-services-wearable:+'
}

#3


6  

I'm using Android Studio Beta version 0.8.1 and I have the same problem. I now I sold my problem by changing the AVD (I'm using Genymotion) to API 19. and here is my build.gradle file

我使用的是Android Studio Beta版的0.8.1,我也有同样的问题。现在,我通过将AVD(我正在使用Genymotion)改为API 19来销售我的问题。这是我的建筑。gradle文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        applicationId "com.example.daroath.actionbar"
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

Android Studio:失败[INSTALL_FAILED_OLDER_SDK]

Hope this help!

希望这次的帮助!

#4


4  

I ran into the same issue and solved it by downloading api level 20 using sdk manager and changing every string that points to android-L. I did it because I dont have a kitkat device and don't want to use emulator. Android Studio:失败[INSTALL_FAILED_OLDER_SDK] See the image download the marked one.

我遇到了同样的问题,通过使用sdk管理器下载api级别20来解决它,并改变指向android-L的每个字符串。我这么做是因为我没有kitkat设备,也不想使用模拟器。请参阅图像下载标记一。

Here's my build config:

这是我的构建配置:

apply plugin: 'com.android.application'

android {
compileSdkVersion 20//changed this from default
buildToolsVersion "20.0.0"

defaultConfig {
    applicationId "com.example.subash.test"
    minSdkVersion 12//changed this from default
    targetSdkVersion 20//changed this from default
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

#5


2  

As mentioned before switching to build 19 is the suggested route here until v20 is "fixed". This thread helped me solve the issue, but it seems similar answers have been posted here as well. https://code.google.com/p/android/issues/detail?id=72840

如前所述,在切换到构建19之前,建议的路由到v20是“固定的”。这个线程帮助我解决了这个问题,但是在这里也有类似的答案。https://code.google.com/p/android/issues/detail?id=72840

#6


2  

<uses-sdk android:minSdkVersion="19"/>

In AndroidManifest.xml worked for me on Android Studio(Beta)0.8.2.

在AndroidManifest。xml在Android Studio(Beta)0.8.2中为我工作。

#7


2  

in the AndroidManifest.xml file change the user-sdk to older version <uses-sdk android:minSdkVersion="19"/>

在AndroidManifest。xml文件将用户sdk更改为旧版本

#8


2  

Change file AndroidManifest.xml

更改文件AndroidManifest.xml

<uses-sdk android:minSdkVersion="19"/>
<uses-sdk android:minSdkVersion="14"/>

#9


2  

After a lot of research i found the solution for this huge error which i was struggling for 2 days.

经过大量的研究,我找到了解决这个巨大错误的方法,我为此挣扎了2天。

Instead of changing the minSdkVerison & targetSdkVersion in build.gradle

而不是在build.gradle中更改minSdkVerison和targetSdkVersion。

Just open the Manifest file and use this

打开清单文件并使用它。

&ltuses-sdk 
android:minSdkVersion="17" 
android:targetSdkVersion="21"/

#10


2  

Failure [INSTALL_FAILED_OLDER_SDK]

失败(INSTALL_FAILED_OLDER_SDK)

basically means that the installation has failed due to the target location (AVD/Device) having an older SDK version than the targetSdkVersion specified in your app.

基本上意味着安装失败,因为目标位置(AVD/设备)有一个比您的应用程序中指定的targetSdkVersion更老的SDK版本。

FROM

apply plugin: 'com.android.application'

android {

compileSdkVersion 'L' //Avoid String change to 20 without quotes
buildToolsVersion "20.0.0"

defaultConfig {
    applicationId "com.vahe_muradyan.notes"
    minSdkVersion 8
    targetSdkVersion 'L' //Set your correct Target which is 17 for Android 4.2.2
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

compile 'com.android.support:appcompat-v7:19.+' // Avoid Generalization 
// can lead to dependencies issues remove +

}

TO

apply plugin: 'com.android.application'

android {
compileSdkVersion 20 
buildToolsVersion "20.0.0"

defaultConfig {
    applicationId "com.vahe_muradyan.notes"
    minSdkVersion 8
    targetSdkVersion 17
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

compile 'com.android.support:appcompat-v7:19.0.0'
}

This is common error from eclipse to now Android Studio 0.8-.8.6

这是目前Android Studio 0.8- 0.8.6的常见错误。

Things to avoid in Android Studio (As for now)

Android Studio中要避免的事情(目前)

  • Avoid Strings instead set API level/Number
  • 避免使用字符串来设置API级别/数字。
  • Avoid generalizing dependencies + be specific
  • 避免泛化依赖关系+具体化。

#11


1  

The real issue is that with vanilla Android Studio v 0.8 beta, it only installs/recognize SDK 20 which is android L. In order to target another complieSDK you need to install it via the SDK manager. Once it is set, you can then change the compileSDK to a lower version and it should work.

真正的问题是,使用Android Studio v0.8测试版,它只安装/识别SDK 20,这是Android l,为了达到另一个要求,你需要通过SDK管理器安装它。一旦设置好,您就可以将编译器更改为较低的版本,并且它应该工作。

you may also want to restrict the compatibility library, it needs to be restricted from using the latest version of the library so change the dependecy to something like :

您可能还想要限制兼容性库,它需要限制使用库的最新版本,因此需要将依赖项更改为:

compile('com.android.support:appcompat-v7:19.1.0') {
    // really use 19.1.0 even if something else resolves higher
    force = true
}

#12


1  

I fixed this problem. I just modified the compileSdk Version from android_L to 19 to target my nexus 4.4.4.

我修复这个问题。我刚刚修改了从android_L到19的编译版本,目标是我的nexus 4.4.4。

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.2'
    }
}
apply plugin: 'com.android.application'

repositories {
    jcenter()
}

android {
    **compileSdkVersion 'android-L'** modified to 19
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.antwei.uiframework.ui"
        minSdkVersion 14
        targetSdkVersion 'L'
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    **compile 'com.android.support:support-v4:21.+'** modified to compile 'com.android.support:support-v4:20.0.0'
}

how to modified the value by ide.

如何通过ide修改该值。

select file->Project Structure -> Facets -> android-gradle and then modified the compile Sdk Version from android_L to 19

选择file->项目结构-> facet -> android-gradle,然后从android_L修改编译Sdk版本到19。

sorry I don't have enough reputation to add pictures

对不起,我没有足够的名气来添加图片。

#13


1  

I initially went into the SDK Manager and updated all that it had set to update.

我最初进入了SDK管理器,并更新了它设置的所有更新。

I also added in the SDK version for the version of Android I had on the Droid I had...Version 2.3.4(10)

我还在SDK版本中添加了Android版本的Android版本。版本2.3.4(10)

I don't think that really fixed anything, and after a Android Studio restart as recommended after the SDK installs, I changed the minSdkVersion to 8 in the build.gradle file

我不认为这真的能解决任何问题,在SDK安装之后,在Android Studio重启后,我将minSdkVersion更改为8。gradle文件

I was then able to download the application to my Droid.

然后我就可以把应用程序下载到我的Droid上了。

defaultConfig {
    applicationId "com.cmcjr.chuck.droid_u"
    minSdkVersion 8
    targetSdkVersion 20
    versionCode 1
    versionName "1.0"
}

This is Android Studio installed on Ubuntu 12.04

这是安装在Ubuntu 12.04上的Android Studio。

#14


1  

Just go to build.gradle(Module:App) and change the minSdkVersion to whatever you are using with emulator.

进入build.gradle(模块:App),并将minSdkVersion更改为您正在使用的模拟器。

Example:

例子:

defaultConfig {
        applicationId "com.example.raghu.sample"
        // Change the version in following line
        minSdkVersion 10 // <-- Whatever you are using with Emulator
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

#15


0  

Just installed Android Studio v 0.8.1 beta and ran into the same problem targeting SDK 19.

刚刚安装了Android Studio v0.8.1 beta,并遇到了同样的问题,目标是SDK 19。

Copied 19 from the adt-bundle to android-studio, changed build.gradle to:

从adt-bundle复制到android-studio,更改了build。gradle:

compileSdkVersion 19 targetSdkVersion 19

compileSdkVersion 19 targetSdkVersion 19

then project -> app -> open module settings (aka project structure): change compile sdk version to 19.

然后项目->应用->开放模块设置(aka项目结构):更改编译sdk版本至19。

Now works fine.

现在好工作。

#16


0  

Similar to a few posts prior - I went to SDK Manager and uninstalled v20 and version L. Then I installed version 19 and this problem was resolved and I could debug using my android device, no errors.

类似于之前的几个帖子——我去了SDK管理器,卸载了v20和版本l,然后我安装了第19版,这个问题已经解决了,我可以用我的android设备调试,没有错误。

#17


0  

Another way to support Android L is to use custom lpreview property for Gradle. For instance:

另一种支持Android L的方法是使用自定义的lpreview属性。例如:

lpreview = hasProperty('lpreview')

apply plugin: 'com.android.application'

android {
    compileSdkVersion lpreview ? "android-L" : 19
    buildToolsVersion "20.0.0"

    productFlavors { lpreview ? lpreview{} : classic{} }

    defaultConfig lpreview ? {} : {
        minSdkVersion 14
        targetSdkVersion 19
    }

Now, you can build your app with:

现在,你可以用:

./gradlew clean
./gradlew -Plpreview assembleDebug

or

./gradlew -Plpreview installLpreviewDebug

This way you can build your app with lpreview property for Android L and without it for previous versions.

这样你就可以用lpreview属性为Android L构建你的应用程序,而不需要之前的版本。

#18


0  

Check the 'minSdkVersion' in your build.gradle

在你的build.gradle中检查“minSdkVersion”。

The default project creates it with the latest API, so if you're phone is not yet up-dated (e.g. minSdkVersion 21), which is probably your case.

默认的项目使用最新的API创建它,所以如果你的手机还没有更新(比如minSdkVersion 21),这可能就是你的情况。

Make sure the minSdkVersion value matches with the device API version or if the device has a higher one.

确保minSdkVersion值与设备API版本匹配,或者如果设备有更高的版本。

Example:

例子:

defaultConfig {
    applicationId 'xxxxxx'
    minSdkVersion 16
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}

#19


0  

your device older than minSDK , edit minSdkVersion in build.gradle

您的设备比minSDK大,在build.gradle中编辑minSdkVersion。

#20


0  

Try changing you sdk min version

尝试改变你的sdk最小版本。

<uses-sdk
    android:minSdkVersion="4"
    android:targetSdkVersion="19" />

#21


0  

One more place where minSdkVersion makes a sense is a flavor:

在这个地方,minSdkVersion的感觉是一种味道:

productFlavors {
    dev {
        minSdkVersion 22
    }
    prod {
        minSdkVersion 9
    }
}

minSdkVersion (22) will not install on development devices with API level older than 22.

minSdkVersion(22)不会安装在超过22岁的API级别的开发设备上。

#22


0  

you need update.

你需要更新。

This is my current solution (09/2015).

这是我目前的解决方案(2015年9月)。

In Android Studio search.

在Android Studio搜索。

Menu --> Help --> check for update

Upate and problem solved!!

Upate和问题解决! !

Good luck

祝你好运

#23


0  

Check the minimum API level inside the build.gradle(module: app)[inside of the gradle scripts]. Thatt should be equal to or lower than the device you use

检查构建中的最小API级别。gradle(模块:app)[在gradle脚本内部]。它应该等于或低于你使用的设备。

#24


0  

In build.gradle change minSdkVersion 17 or later.

在构建。gradle更改minSdkVersion 17或更高版本。

#1


27  

There are my config to support L and old versions of android:

有我的配置支持L和旧版本的android:

apply plugin: 'com.android.application'

android {
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.example.uladzimir_klyshevich.myapplication"
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }


    productFlavors {
        l {
            minSdkVersion 'android-L'
            targetSdkVersion 'android-L'
            compileSdkVersion 'android-L'
        }
        old {
            minSdkVersion 10
            targetSdkVersion 20
            //TODO comment second line if build is not compiles for "L"
            compileSdkVersion 20
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    lCompile 'com.android.support:appcompat-v7:21.+'
    oldCompile 'com.android.support:appcompat-v7:19.1.0'
}

As result you will have flavors:

因此你会有不同的口味:

oldDebug
oldRelease
lDebug
lRelease

And can install your application on old versions of android.

并且可以在旧版本的android上安装您的应用程序。

#2


12  

Do those changes in build.gradle file in the wear module

在构建过程中进行这些更改。磨损模块的分级文件。

compileSdkVersion 20
targetSdkVersion 20

So the final wear/build.gradle content will be:

所以最终穿/构建。gradle内容将:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "your package name"
        minSdkVersion 20
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.support:wearable:+'
    compile 'com.google.android.gms:play-services-wearable:+'
}

#3


6  

I'm using Android Studio Beta version 0.8.1 and I have the same problem. I now I sold my problem by changing the AVD (I'm using Genymotion) to API 19. and here is my build.gradle file

我使用的是Android Studio Beta版的0.8.1,我也有同样的问题。现在,我通过将AVD(我正在使用Genymotion)改为API 19来销售我的问题。这是我的建筑。gradle文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        applicationId "com.example.daroath.actionbar"
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

Android Studio:失败[INSTALL_FAILED_OLDER_SDK]

Hope this help!

希望这次的帮助!

#4


4  

I ran into the same issue and solved it by downloading api level 20 using sdk manager and changing every string that points to android-L. I did it because I dont have a kitkat device and don't want to use emulator. Android Studio:失败[INSTALL_FAILED_OLDER_SDK] See the image download the marked one.

我遇到了同样的问题,通过使用sdk管理器下载api级别20来解决它,并改变指向android-L的每个字符串。我这么做是因为我没有kitkat设备,也不想使用模拟器。请参阅图像下载标记一。

Here's my build config:

这是我的构建配置:

apply plugin: 'com.android.application'

android {
compileSdkVersion 20//changed this from default
buildToolsVersion "20.0.0"

defaultConfig {
    applicationId "com.example.subash.test"
    minSdkVersion 12//changed this from default
    targetSdkVersion 20//changed this from default
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

#5


2  

As mentioned before switching to build 19 is the suggested route here until v20 is "fixed". This thread helped me solve the issue, but it seems similar answers have been posted here as well. https://code.google.com/p/android/issues/detail?id=72840

如前所述,在切换到构建19之前,建议的路由到v20是“固定的”。这个线程帮助我解决了这个问题,但是在这里也有类似的答案。https://code.google.com/p/android/issues/detail?id=72840

#6


2  

<uses-sdk android:minSdkVersion="19"/>

In AndroidManifest.xml worked for me on Android Studio(Beta)0.8.2.

在AndroidManifest。xml在Android Studio(Beta)0.8.2中为我工作。

#7


2  

in the AndroidManifest.xml file change the user-sdk to older version <uses-sdk android:minSdkVersion="19"/>

在AndroidManifest。xml文件将用户sdk更改为旧版本

#8


2  

Change file AndroidManifest.xml

更改文件AndroidManifest.xml

<uses-sdk android:minSdkVersion="19"/>
<uses-sdk android:minSdkVersion="14"/>

#9


2  

After a lot of research i found the solution for this huge error which i was struggling for 2 days.

经过大量的研究,我找到了解决这个巨大错误的方法,我为此挣扎了2天。

Instead of changing the minSdkVerison & targetSdkVersion in build.gradle

而不是在build.gradle中更改minSdkVerison和targetSdkVersion。

Just open the Manifest file and use this

打开清单文件并使用它。

&ltuses-sdk 
android:minSdkVersion="17" 
android:targetSdkVersion="21"/

#10


2  

Failure [INSTALL_FAILED_OLDER_SDK]

失败(INSTALL_FAILED_OLDER_SDK)

basically means that the installation has failed due to the target location (AVD/Device) having an older SDK version than the targetSdkVersion specified in your app.

基本上意味着安装失败,因为目标位置(AVD/设备)有一个比您的应用程序中指定的targetSdkVersion更老的SDK版本。

FROM

apply plugin: 'com.android.application'

android {

compileSdkVersion 'L' //Avoid String change to 20 without quotes
buildToolsVersion "20.0.0"

defaultConfig {
    applicationId "com.vahe_muradyan.notes"
    minSdkVersion 8
    targetSdkVersion 'L' //Set your correct Target which is 17 for Android 4.2.2
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

compile 'com.android.support:appcompat-v7:19.+' // Avoid Generalization 
// can lead to dependencies issues remove +

}

TO

apply plugin: 'com.android.application'

android {
compileSdkVersion 20 
buildToolsVersion "20.0.0"

defaultConfig {
    applicationId "com.vahe_muradyan.notes"
    minSdkVersion 8
    targetSdkVersion 17
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

compile 'com.android.support:appcompat-v7:19.0.0'
}

This is common error from eclipse to now Android Studio 0.8-.8.6

这是目前Android Studio 0.8- 0.8.6的常见错误。

Things to avoid in Android Studio (As for now)

Android Studio中要避免的事情(目前)

  • Avoid Strings instead set API level/Number
  • 避免使用字符串来设置API级别/数字。
  • Avoid generalizing dependencies + be specific
  • 避免泛化依赖关系+具体化。

#11


1  

The real issue is that with vanilla Android Studio v 0.8 beta, it only installs/recognize SDK 20 which is android L. In order to target another complieSDK you need to install it via the SDK manager. Once it is set, you can then change the compileSDK to a lower version and it should work.

真正的问题是,使用Android Studio v0.8测试版,它只安装/识别SDK 20,这是Android l,为了达到另一个要求,你需要通过SDK管理器安装它。一旦设置好,您就可以将编译器更改为较低的版本,并且它应该工作。

you may also want to restrict the compatibility library, it needs to be restricted from using the latest version of the library so change the dependecy to something like :

您可能还想要限制兼容性库,它需要限制使用库的最新版本,因此需要将依赖项更改为:

compile('com.android.support:appcompat-v7:19.1.0') {
    // really use 19.1.0 even if something else resolves higher
    force = true
}

#12


1  

I fixed this problem. I just modified the compileSdk Version from android_L to 19 to target my nexus 4.4.4.

我修复这个问题。我刚刚修改了从android_L到19的编译版本,目标是我的nexus 4.4.4。

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.2'
    }
}
apply plugin: 'com.android.application'

repositories {
    jcenter()
}

android {
    **compileSdkVersion 'android-L'** modified to 19
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.antwei.uiframework.ui"
        minSdkVersion 14
        targetSdkVersion 'L'
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    **compile 'com.android.support:support-v4:21.+'** modified to compile 'com.android.support:support-v4:20.0.0'
}

how to modified the value by ide.

如何通过ide修改该值。

select file->Project Structure -> Facets -> android-gradle and then modified the compile Sdk Version from android_L to 19

选择file->项目结构-> facet -> android-gradle,然后从android_L修改编译Sdk版本到19。

sorry I don't have enough reputation to add pictures

对不起,我没有足够的名气来添加图片。

#13


1  

I initially went into the SDK Manager and updated all that it had set to update.

我最初进入了SDK管理器,并更新了它设置的所有更新。

I also added in the SDK version for the version of Android I had on the Droid I had...Version 2.3.4(10)

我还在SDK版本中添加了Android版本的Android版本。版本2.3.4(10)

I don't think that really fixed anything, and after a Android Studio restart as recommended after the SDK installs, I changed the minSdkVersion to 8 in the build.gradle file

我不认为这真的能解决任何问题,在SDK安装之后,在Android Studio重启后,我将minSdkVersion更改为8。gradle文件

I was then able to download the application to my Droid.

然后我就可以把应用程序下载到我的Droid上了。

defaultConfig {
    applicationId "com.cmcjr.chuck.droid_u"
    minSdkVersion 8
    targetSdkVersion 20
    versionCode 1
    versionName "1.0"
}

This is Android Studio installed on Ubuntu 12.04

这是安装在Ubuntu 12.04上的Android Studio。

#14


1  

Just go to build.gradle(Module:App) and change the minSdkVersion to whatever you are using with emulator.

进入build.gradle(模块:App),并将minSdkVersion更改为您正在使用的模拟器。

Example:

例子:

defaultConfig {
        applicationId "com.example.raghu.sample"
        // Change the version in following line
        minSdkVersion 10 // <-- Whatever you are using with Emulator
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

#15


0  

Just installed Android Studio v 0.8.1 beta and ran into the same problem targeting SDK 19.

刚刚安装了Android Studio v0.8.1 beta,并遇到了同样的问题,目标是SDK 19。

Copied 19 from the adt-bundle to android-studio, changed build.gradle to:

从adt-bundle复制到android-studio,更改了build。gradle:

compileSdkVersion 19 targetSdkVersion 19

compileSdkVersion 19 targetSdkVersion 19

then project -> app -> open module settings (aka project structure): change compile sdk version to 19.

然后项目->应用->开放模块设置(aka项目结构):更改编译sdk版本至19。

Now works fine.

现在好工作。

#16


0  

Similar to a few posts prior - I went to SDK Manager and uninstalled v20 and version L. Then I installed version 19 and this problem was resolved and I could debug using my android device, no errors.

类似于之前的几个帖子——我去了SDK管理器,卸载了v20和版本l,然后我安装了第19版,这个问题已经解决了,我可以用我的android设备调试,没有错误。

#17


0  

Another way to support Android L is to use custom lpreview property for Gradle. For instance:

另一种支持Android L的方法是使用自定义的lpreview属性。例如:

lpreview = hasProperty('lpreview')

apply plugin: 'com.android.application'

android {
    compileSdkVersion lpreview ? "android-L" : 19
    buildToolsVersion "20.0.0"

    productFlavors { lpreview ? lpreview{} : classic{} }

    defaultConfig lpreview ? {} : {
        minSdkVersion 14
        targetSdkVersion 19
    }

Now, you can build your app with:

现在,你可以用:

./gradlew clean
./gradlew -Plpreview assembleDebug

or

./gradlew -Plpreview installLpreviewDebug

This way you can build your app with lpreview property for Android L and without it for previous versions.

这样你就可以用lpreview属性为Android L构建你的应用程序,而不需要之前的版本。

#18


0  

Check the 'minSdkVersion' in your build.gradle

在你的build.gradle中检查“minSdkVersion”。

The default project creates it with the latest API, so if you're phone is not yet up-dated (e.g. minSdkVersion 21), which is probably your case.

默认的项目使用最新的API创建它,所以如果你的手机还没有更新(比如minSdkVersion 21),这可能就是你的情况。

Make sure the minSdkVersion value matches with the device API version or if the device has a higher one.

确保minSdkVersion值与设备API版本匹配,或者如果设备有更高的版本。

Example:

例子:

defaultConfig {
    applicationId 'xxxxxx'
    minSdkVersion 16
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}

#19


0  

your device older than minSDK , edit minSdkVersion in build.gradle

您的设备比minSDK大,在build.gradle中编辑minSdkVersion。

#20


0  

Try changing you sdk min version

尝试改变你的sdk最小版本。

<uses-sdk
    android:minSdkVersion="4"
    android:targetSdkVersion="19" />

#21


0  

One more place where minSdkVersion makes a sense is a flavor:

在这个地方,minSdkVersion的感觉是一种味道:

productFlavors {
    dev {
        minSdkVersion 22
    }
    prod {
        minSdkVersion 9
    }
}

minSdkVersion (22) will not install on development devices with API level older than 22.

minSdkVersion(22)不会安装在超过22岁的API级别的开发设备上。

#22


0  

you need update.

你需要更新。

This is my current solution (09/2015).

这是我目前的解决方案(2015年9月)。

In Android Studio search.

在Android Studio搜索。

Menu --> Help --> check for update

Upate and problem solved!!

Upate和问题解决! !

Good luck

祝你好运

#23


0  

Check the minimum API level inside the build.gradle(module: app)[inside of the gradle scripts]. Thatt should be equal to or lower than the device you use

检查构建中的最小API级别。gradle(模块:app)[在gradle脚本内部]。它应该等于或低于你使用的设备。

#24


0  

In build.gradle change minSdkVersion 17 or later.

在构建。gradle更改minSdkVersion 17或更高版本。