前提・実現したいこと
Android Studio(kotlin)でアプリのデータベースの使い方を勉強しようと思い、
realmというものを知ったので、導入しようと思った矢先・・・。
「参考にしているサイトや記事が、どれもちょっとずつ古い」ため、
ずっと何かしらエラーメッセージ的なものが出ているので困っています。
現時点での正しい書き方を知りたいです。
現時点で一番参考になったのはこちらの記事です。
https://teratail.com/questions/340534
(↑ただ質問者も「なぜか解決した」感じで根本的なところを把握していたかどうかは微妙な様子)
発生している問題・エラーメッセージ
jcenter maven repository is no longer receiving updates:newer library versions may be available elsewehre
該当のソースコード
▼build.gradel(:app)
kotlin
1plugins { 2 id 'com.android.application' 3 id 'org.jetbrains.kotlin.android' 4} 5 6apply plugin: 'com.android.application' 7apply plugin: 'kotlin-android' 8apply plugin: 'kotlin-android-extensions' 9apply plugin: 'kotlin-kapt' 10apply plugin: 'realm-android' 11 12android { 13 compileSdk 31 14 15 defaultConfig { 16 applicationId "com.example.samplerealm" 17 minSdk 21 18 targetSdk 31 19 versionCode 1 20 versionName "1.0" 21 22 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 23 } 24 25 buildTypes { 26 release { 27 minifyEnabled false 28 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 29 } 30 } 31 compileOptions { 32 sourceCompatibility JavaVersion.VERSION_1_8 33 targetCompatibility JavaVersion.VERSION_1_8 34 } 35 kotlinOptions { 36 jvmTarget = '1.8' 37 } 38} 39 40dependencies { 41 42 implementation 'androidx.core:core-ktx:1.7.0' 43 implementation 'androidx.appcompat:appcompat:1.4.1' 44 implementation 'com.google.android.material:material:1.5.0' 45 implementation 'androidx.constraintlayout:constraintlayout:2.1.3' 46 testImplementation 'junit:junit:4.13.2' 47 androidTestImplementation 'androidx.test.ext:junit:1.1.3' 48 androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' 49}
▼build.gradle(project:)
kotlin
1// Top-level build file where you can add configuration options common to all sub-projects/modules. 2buildscript { 3 repositories { 4 jcenter() 5 } 6 dependencies { 7 classpath "io.realm:realm-gradle-plugin:10.8.0" 8 } 9} 10 11 12plugins { 13 id 'com.android.application' version '7.1.2' apply false 14 id 'com.android.library' version '7.1.2' apply false 15 id 'org.jetbrains.kotlin.android' version '1.6.10' apply false 16} 17 18task clean(type: Delete) { 19 delete rootProject.buildDir 20}
試したこと
色んなサイトを参考にしながら、ようやくここまでたどり着いた、という所で、
またしてもWarning・・・ということで、力尽きました。
●結局、今のところは合っているのか(jcenterの記述だけが違う)
●そもそも、今までのところが全部違うから何をやってもエラーなのか
自分では判断がつきません。
Realmの記述は、日に日に変化するようで、どのサイトも「ちょっとずつみなさん違う」というのも
素人には混乱の原因のようでして・・・。
現時点での正しい書き方をご教授願いたい
補足情報(FW/ツールのバージョンなど)
Android Studio Bumblebee
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。