Android 5.0 SDK 対応はまず何をしたらいいか

デザインとかもあるけどまずはでとりあえず.

Android_5_0_Lollipop_の_SDK_と、新しい_Nexus_プレビュー版イメージを公開しました_-_Google_Developer_Japan_Blog

SDKをAPI21に更新.

Android_SDK_Manager

Project_Structure

...
android {
    compileSdkVersion 21
    buildToolsVersion "21.0.0"

    defaultConfig {
        ...
        targetSdkVersion 21
        ...
    }
...

NDKをr10cに更新.

Android_NDK___Android_Developers

ndk~$ chmod a+x android-ndk-r10c-darwin-x86_64.bin
ndk~$ ./android-ndk-r10c-darwin-x86_64.bin
...
Extracting  android-ndk-r10c/build/gmsl
Extracting  android-ndk-r10c/build/core
Extracting  android-ndk-r10c/build/awk
Extracting  android-ndk-r10c/build
Extracting  android-ndk-r10c

ndk~$ export PATH=$PATH:~/android-ndk-r10c

Android NDK | Android Developers

とりあえずこれくらいで.

Android 5.0 Lollipop の SDK と、新しい Nexus プレビュー版イメージを公開しました - Google Developer Japan Blog


gradle なら AndroidManifest.xml 内 <uses-sdk> が不要だった件

_uses-sdk____Android_Developers

Android Studio が警告なフキダシを出してる.

main_AndroidManifest

記述が2箇所あってきもちが悪かったのですが.

build.gradle

android {
    ...
    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 19
    }
    ...
}

AndroidManifest.xml

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

Android Studio の設定で「バージョン」の記述してるとこありすぎね?

で, AndroidManifest.xml側の記述は不要らしい.

Gradle overrides the manifest values, and I prefer to update build.gradle file rather than manifest. And probably this is the right way using Gradle. Gradle supports product flavours which can be controled via IDE and those product flavors can change many things in our Manifest like package name, version code, version name, target SDK and many other. Then by one click in Android Studio You can change many properties and generate another apk.

You can left the manifest as it is and do all configuration in build.gradle. You can safely remove

<uses-sdk></uses-sdk>

from manifest as well as version codes.

Android studio: why are minSdkVersion and targetSdkVersion specified both in AndroidManifest.xml and build.gradle? - Stack Overflow

Gradle が自動埋め込んでくれるっぽい.

apk化後, バラしてみてみると確認できます.

android-apktool - A tool for reverse engineering Android apk files - Google Project Hosting


ひさびさに更新したら動かないプロジェクトたち #androidstudio

8/1 になんだかんだというのでちまちまやってるといろんなことがおこる.

【 Android_ID / IMEI を使ったらアウト?! 】8/1 以降 「端末の特定」はすべて Google「広告ID」経由に

build tool を 19.1.0 にする.

android {
    compileSdkVersion 19
    buildToolsVersion ’19.1.0'

Gradle Plugin のバージョンを 0.12.0 以降にする.

buildscript {
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'

Error:The project is using an unsupported version of Gradle. Please use version 1.12.
Please point to a supported Gradle version in the project's Gradle settings or in the project's Gradle wrapper (if applicable.)

gradle/wrapper/gradle-wrapper.properties

distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip

Error:Execution failed for task ’sample:processDefaultFlavorDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 17 cannot be smaller than version L declared in library com.android.support:appcompat-v7:21.0.0-rc1

appcompat が 21 を拾ってエラー
→ 19.+ に

dependencies {
    compile 'com.android.support:appcompat-v7:19.+'
    compile 'com.google.android.gms:play-services:+’

Warning:(21, 25) Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the android.os.Build.VERSION_CODES javadoc for details.

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7

Gradle のバージョンて こんな風になってたのかっ

Android_Studio_Gradle_issue_upgrading_to_version_0_5_0_-_Gradle_Migrating_From_0_8_to_0_9_-_Also_Android_Studio_upgrade_to_0_8_1_-_Stack_Overflow

Android Studio Gradle issue upgrading to version 0.5.0 - Gradle Migrating From 0.8 to 0.9 - Also Android Studio upgrade to 0.8.1 - Stack Overflow