さてさて、android5.0が正式にリリースされました。そして、今回のandroid5.0では、かなりの大幅な変更が行われました。
というわけでさっそく対応しようと思います。対応するアプリは現在4.4.2で作成中のアプリなので、参考になれば幸いです。
せっかくswiftに注力できると思ったのに…。
環境
- android:minSdkVersion="14"
- android:targetSdkVersion="19"
- andoid studio 0.8.9
gradleを以下のように書き換えます。
Before
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.test.testapp"
minSdkVersion 14
targetSdkVersion 19
testApplicationId "com.test.testapp.test"
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
buildTypes {
debug {
}
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':volley')
compile 'com.android.support:support-v4:20.0.0'
compile 'com.google.android.gms:play-services:5.0.89'
compile 'com.google.code.gson:gson:2.3'
compile files('libs/twitter4j-core-4.0.2.jar')
androidTestCompile files('libs/espresso-1.1-bundled.jar')
}
After
apply plugin: 'com.android.application'
android {
// 19 → 21
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.test.testapp"
minSdkVersion 14
// 19 → 21
targetSdkVersion 21
testApplicationId "com.test.testapp.test"
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
buildTypes {
debug {
}
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':volley')
// 20 → 21
compile 'com.android.support:support-v4:21.0.0'
// 6.1にする
compile 'com.google.android.gms:play-services:6.1.+'
compile 'com.google.code.gson:gson:2.3'
compile files('libs/twitter4j-core-4.0.2.jar')
androidTestCompile files('libs/espresso-1.1-bundled.jar')
// これが欲しい
compile 'com.android.support:appcompat-v7:21.0.+'
}
上記のように変更しないと、Attribute "theme" has already been definedやら、android:actionModeShareDrawableやらが発生します。
androidのupdateの弱点は、play-servicesがすぐに対応しなくなることですね。これは本当にやっかいです。
あとはいつものようにbuildをすればOK。テストコードを走らせて、動作確認がうまくいけば問題ないでしょう。
cardViewやRecycleViewあたりは、かなり良さそうなので積極的に利用していきたいですね。
参考サイト
0 件のコメント:
コメントを投稿