◇AndroidStudio3.0.1対応
備忘録:大変でした。こういうのは理屈ではないので。。。
AndroidStidio3.0.1
AndroidStudioが3.0.1に上がりました。
これまでのものがエラーになります。
対処したメモです。
旧プロジェクト読み込み時の操作
旧プロジェクトを読み込む時、AndroidStidio3.0.1への変換が行われる場合があります。
Convert Projectが出たら [Convert]
Android Gradle Plugin Update Recomenndedが出たら [Update]
rebuildエラーに対する処置(build.gradle修正)
clear project/rebuild projectでエラーが出る場合app/src/build.gradleの編集が必要となります。
Error:(27, 0) Cannot set the value of read-only property
'outputFile' for ApkVariantOutputImpl_Decorated{apkData=
Main{type=MAIN, fullName=release, filters=[]}} of type
com.android.build.gradle.internal.api.ApkVariantOutputImpl.
が出たら
app/src/build.gradleのapplicationVariants.allを置き換える
applicationVariants.all { variant ->
if (variant.buildType.name.equals("release")) {
variant.outputs.all {
def versionName = variant.versionName
def date = new java.text
.SimpleDateFormat("yyyyMMdd_HHmmss")
.format(new Date())
def newName = "apk_v${versionName}_${date}.apk"
outputFileName = newName
}
}
}
// apkは自分のアプリの名前にする
次のエラー
Warning:The specified Android SDK Build Tools version (22.0.1) is ignored, as it is below the minimum supported version (26.0.2) for Android Gradle Plugin 3.0.1. Android SDK Build Tools 26.0.2 will be used.が出たら app/src/build.gradleのbuildToolsVersionを置き換える を置き換える
buildToolsVersion "26.0.2"
明示的Gradleのupdate
次のエラーが出る場合、Gradleのupgradeと、場合によってはclasspathの設定が必要になります。
Error:Unsupported method: BaseConfig.getApplicationIdSuffix(). The version of Gradle you connect to does not support that method. To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Gradleの明示的upgradeは
[File]-[Project Structure]-[Project]で行います。
classpathの設定
Gradleのupgadeを行っても
Error:Unsupported method: BaseConfig.getApplicationIdSuffix(). The version of Gradle you connect to does not support that method. To resolve the problem you can change/upgrade the target version of Gradle you connect to.あるいは
Error:(11, 1) A problem occurred evaluating project ':app'. > Cannot invoke method versionName() on null objectが出る場合は、app/src/build.gradleのbuildscript.dependenciesでclasspathを追加または変更します。
dependencies { // こちらのdependenciesではない compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.1.1' } buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' } }
Javaのバージョン
それでも次のエラーが出る場合は
Error:Unsupported method: BaseConfig.getApplicationIdSuffix(). The version of Gradle you connect to does not support that method. To resolve the problem you can change/upgrade the target version of Gradle you connect to.Javaのバージョンを変更します。
Fileメニュー
other settings
Default Project Structure
Use Embedded JDK
build.gradleの例
build.gradleの例を載せます
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "xx.yy.zz"
minSdkVersion 8
targetSdkVersion 22
versionCode 1
versionName "1.2.5"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt')
,'proguard-rules.pro'
}
}
applicationVariants.all { variant ->
if (variant.buildType.name.equals("release")) {
variant.outputs.all {
def versionName = variant.versionName
def date = new java.text
.SimpleDateFormat("yyyyMMdd_HHmmss")
.format(new Date())
def newName = "myApp_v${versionName}.apk"
outputFileName = newName
}
}
}
}
// myAppはapp毎の名前
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
GooglePlayConsoleで「APK の署名が無効」
APPリリースのバージョンupで次のエラーが出る場合はアップロードできませんでした アップロードした APK の署名が無効です(署名の詳細)。 apksigner のエラー: ERROR: JAR_SIG_NO_SIGNATURES: No JAR signaturesが出る場合はビルド時
Buildメニュー
[Generate Signed APK]
[Next]
に「V1 (jar Signature)」と「V2 (FullAPK Signature)」の両方にチェックを入れます。
GooglePlayConsoleで「プライバシーポリシーの設定」
APPリリースのバージョンupで次のエラー
プライバシー ポリシーが必要な権限(android.permission.CAMERA•画像/メディア/ファイルというエラーになる場合
-
どこかにプライバシーポリシー表示用のhtmlファイルを置く
内容には決まった規則はないが例えば次の様に当該permissionに関する説明を書く。<!DOCTYPE html> <html> <head> <title>プライバシーポリシー(カメラ)</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> </head> <body> <ul> <li>カメラ(画像と動画の撮影) <ul> <li>現実の風景を色相変換して示します。</li> <li>撮影された画像は内蔵ストレージや SD カードに保存されます</li> </ul> </li> </ul> </body> </html> -
GooglePlayConsoleで次の設定を行う
[全てのアプリ] アプリ選択 [ストアでの表示] [ストア掲載情報] ↓の方にある [プライバシーポリシー]にURLを設定
プライバシーポリシー表示用のhtmlファイルを置く場所に制限はありません。 アクセス可能であればどこでもよく、例えばブログのデータ置き場でも構いません。
プライバシーポリシー表示用の記述の形式に決まりはありません。人が読んで意味が分かればよいようです。
| 固定リンク

