2017-10-21 4 views
1
apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "26.0.1" 
    defaultConfig { 
     applicationId "com.ta2323.ftsm.lab_recyclerview_a160158" 
     minSdkVersion 15 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:26.0.0-alpha1' 
    compile 'com.android.support:recyclerview-v7:26.0.0-alpha1' 
    compile 'com.android.support:cardview-v7:26.0.0-alpha1' 
} 

誰かが私を助けることができますか?私は何を使うべきかわからないし、私はどのバージョンを使うのか混乱している。誰かが詳細を説明できますか? これはビルドgradleで私のコーディングです。私は自分のcompileSdkVersionに何を設定すべきですか?

答えて

0

ビルドツールバージョンのプレフィックスと同じ、コンパイルSDKバージョンを使用してください。そして、常に最新のものに行く。だから今は26を使ってください。

1

compileSdkVersion

compileSdkVersionプロパティは、コンパイルのターゲットを指定します。

最新の目標SDKのバージョンは26がそう

compileSdkVersion SDKのバージョン26をコンパイル使用しているアプリがに対してコンパイルされたAPIのバージョンです。つまり、APIのバージョンに含まれているAndroid API機能を使用できます(以前のバージョンと同様)。 API 16機能を試して使用するがcompileSdkVersionを15に設定すると、コンパイルエラーが発生します。あなたは16にcompileSdkVersionを設定した場合、あなたはまだ限り、アプリケーションの実行パスが

あなたは常にべきよりhere

0

を参照してくださいAPI 16に固有のAPIを呼び出すためにしようとしないようAPI 15デバイス上でアプリケーションを実行することができます

  1. compileSdkVersion
  2. buildToolsVersion
  3. :あなたのbuild.gradleに次のために同じバージョンを使用
  4. targetSdkVersion
  5. サポートライブラリ

バージョン26にsupport librarybuildToolsVersionを設定しているので、あなたは上記のすべてのリストについては、に固執する必要があります。あなたがそうAPI 26用のビルドツールを指定しているbuildToolsVersion "26.0.1"を使用しているとき、あなたは(コメントを読んで)このような何かにあなたのbuild.gradleを変更する必要があるので、これは次のとおりです。

apply plugin: 'com.android.application' 

android { 

    /** 
    * compileSdkVersion specifies the Android API level Gradle should use to 
    * compile your app. This means your app can use the API features included in 
    * this API level and lower. 
    */ 

    compileSdkVersion 26 

    /** 
    * buildToolsVersion specifies the version of the SDK build tools, command-line 
    * utilities, and compiler that Gradle should use to build your app. You need to 
    * download the build tools using the SDK Manager. 
    * 
    * If you're using Android plugin 3.0.0 or higher, this property is optional— 
    * the plugin uses the minimum required version of the build tools by default. 
    */ 

    buildToolsVersion "26.0.2" 

    defaultConfig { 
     // Defines the minimum API level required to run the app. 
     minSdkVersion 15 

     // Specifies the API level used to test the app. 
     targetSdkVersion 26 

     ... 
    } 

} 

dependencies { 
    ... 
    // NEVER USE ALPHA Version in your dependencies. 
    compile 'com.android.support:appcompat-v7:26.1.0' 
    compile 'com.android.support:recyclerview-v726.1.0' 
    compile 'com.android.support:cardview-v7:26.1.0' 
} 

Configure Your Build

で続きを読みます