azz-tokyo / WalkRecord

0 stars 1 forks source link

RemoteConfigでのアプリバージョンの管理 #61

Open azzrhoshino opened 4 years ago

azzrhoshino commented 4 years ago

Firebase Remote Configを利用したバージョン管理を行う

処理概要(VersionCheck処理を置き換え)

参考ページ https://firebase.google.com/docs/remote-config/use-config-android?hl=ja https://qiita.com/masaibar/items/f32a788159f210abd262 https://qiita.com/tonobee/items/dc5b98aeebfe76cc1262

設定準備

参考ページ https://firebase.google.com/docs/android/setup?hl=ja

ghost commented 4 years ago

@azzrhoshino

参考ページ https://firebase.google.com/docs/android/setup?hl=ja

の手順に従い、 build.gradle →build.gradle.txt app/build.gradle →添付app-build.gradle.txt を修正し、 appディレクトリ配下に、メールにて頂いたgoogle-services.json を配置したところ、 添付のビルドエラー(ビルドエラー.log)が発生しました

情報展開させていただきます。 エラー除去の方法について、ご教示をお願いします。

app-build.gradle.txt build.gradle.txt ビルドエラー.log

azzrhoshino commented 4 years ago

直接原因はbuild.gradleにbuildscriptの記載が2つあるのでそのためエラーになっていると思います。

また、publicな環境なのでgoogle-services.jsonは念のため添付しないようにお願いします。 gitでもignore対象としてください。

別件ですが、本実装で動作確認できる状態となったら、versionNameの値が比較対象となります。

ghost commented 4 years ago

@azzrhoshino 回答が遅くなり、すみません。

直接原因はbuild.gradleにbuildscriptの記載が2つあるのでそのためエラーになっていると思います。

上記回答に従い、build.gradleにbuildscript の記載の重複を除去しました。

また、publicな環境なのでgoogle-services.jsonは念のため添付しないようにお願いします。 gitでもignore対象としてください。

こちらについては、2/24に編集したコメントから削除しました。 また、git(sourcetree)上で.gitignoreに追加し、コミット対象から外れたことを確認しました。

その後、添付の通り、別のビルドエラーが発生しました。 ネット検索で原因を調べてみましたが、解決ができないため、 お手数ですが、再度ご教示をお願いします。

build.gradle.txt app-build.gradle.txt ビルドエラー2.log

azzrhoshino commented 4 years ago

@y-okae com.google.firebase:firebaseのライブラリが途中からAndroidXライブラリとなったため、旧サポートライブラリと同時に使うと競合が発生することが原因ではないかと思います。

本来は新しいライブラリに刷新するべきですが、今回はいったん動かせるようにすることを優先して古いライブラリで統一したいと思います。

appのbuild.gradleに下記を設定してみてください ちなみに、firebase-coreはアナリティクス用なので今回の対象外です

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation 'com.google.android.gms:play-services-location:15.0.1'
//    implementation 'com.google.android.gms:play-services:11.0.1'
    testImplementation 'junit:junit:4.12'
    implementation 'org.jsoup:jsoup:1.12.1'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.firebase:firebase-config:16.0.0'
}
ghost commented 4 years ago

@azzrhoshino 回答が遅くなりすみません。

appのbuild.gradleに下記を設定してみてください

上記設定をすることにより、ビルドエラーの発生を除去し、アプリ起動することが出来ました。 これから実装の方の内容調査を実施します。

取り急ぎご報告させていただきます。

ghost commented 4 years ago

@azzrhoshino

上記の変更点をローカルでfeature/issues/61 ブランチを作成し、sourcetreeでプッシュしたところ、 下記のエラーが出てプッシュできません。

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks push -v --tags --set-upstream origin feature/issues/61:feature/issues/61
remote: Permission to azz-tokyo/WalkRecord.git denied to y-okae.
fatal: unable to access 'https://github.com/azz-tokyo/WalkRecord.git/': The requested URL returned error: 403

git bash でpushしたところ、以下のエラーが出ました。

$ git push origin feature/issues/61
remote: Permission to azz-tokyo/WalkRecord.git denied to y-okae.
fatal: unable to access 'https://github.com/azz-tokyo/WalkRecord.git/': The requested URL returned error: 403

お手数ですが、ご教示くださいますよう、お願い申し上げます。

azzrhoshino commented 4 years ago

ブランチを移動させたことが原因で権限がなくなっているかもしれません。 確認するのでお待ちください。