2016-07-26 46 views
1

我試圖改變它在build.gradle如何更改Android Studio中的minSdkVersion?

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 'android-N' 
buildToolsVersion '21.1.2' 
defaultConfig { 
    applicationId "com.example.shubham.warning" 
    minSdkVersion 15 
    targetSdkVersion 20 
    versionCode 1 
    versionName "1.0" 
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    lintOptions { 

     checkReleaseBuilds false 

    } 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-    rules.pro' 
    } 
    } 
    } 

dependencies { 
compile fileTree(include: ['*.jar'], dir: 'libs') 
compile 'com.android.support:appcompat-v7:24.0.0-beta1' 
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha3' 
testCompile 'junit:junit:4.12' 
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' 
androidTestCompile 'com.android.support.test:runner:0.5' 
androidTestCompile 'com.android.support:support-annotations:24.0.0-beta1' 
} 

這是我的清單文件

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.example.shubham.warning" > 
<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme" > 
    <activity android:name=".Warning" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

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

    </manifest> 

但每當我嘗試測試它在我的AVD它顯示了以下錯誤:

minSdk(API 23, N preview)!=deviceSdk(api 22)

enter image description here

i已經改變它在builg.gradle 但它仍然顯示在錯誤中的apk 23

+0

檢查你的menifest文件,如果你有其他的東西 – Vickyexpert

回答

0

你試過這個嗎?
工具>安卓>同步項目與搖籃文件

此外,
構建>清理項目
構建>重建項目

如果仍然沒有工作,嘗試手動重新啓動Android的工作室。

希望這會有所幫助。如果您仍然看到相同的問題,請告訴我。

+0

我試過了,它仍然不工作 –

相關問題