前提・実現したいこと
はじめてのAndroidプログラミング第5版を参考にスケジューラアプリを作成しています。
Reamlの導入に失敗してエラーが出ているのですが、エラーの内容がわかりません。
プログラミングを始めたばかりで知識がないのですが、エラーの内容と解決方法を教えていただければと思います。
発生している問題・エラーメッセージ
Caused by: groovy.lang.MissingMethodException: No signature of method: build_1pumvo0n1h6rufl5tokc5q6ol.android() is applicable for argument types: (build_1pumvo0n1h6rufl5tokc5q6ol$_run_closure1) values: [build_1pumvo0n1h6rufl5tokc5q6ol$_run_closure1@1b70cce1]
該当のソースコード
kotlin
1 2//build.gradle(:app) 3 4plugins { 5 id 'com.android.application' 6 id 'kotlin-android' 7 id 'kotlin-kapt' 8 id 'realm-android' 9} 10 11android { 12 compileSdk 32 13 14 defaultConfig { 15 applicationId "com.example.myscheduler" 16 minSdk 23 17 targetSdk 32 18 versionCode 1 19 versionName "1.0" 20 21 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 22 } 23 24 buildTypes { 25 release { 26 minifyEnabled false 27 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 28 } 29 } 30 31 compileOptions { 32 sourceCompatibility JavaVersion.VERSION_1_8 33 taegetCompatibility JavaVersion.VERSION_1_8 34 } 35 kotlinOptions { 36 jvmTarget = '1.8' 37 } 38 buildFeatures { 39 viewBinding true 40 } 41} 42 43dependencies { 44 45 implementation 'io.realm:android-adapters:2.1.1' 46 implementation 'androidx.core:core-ktx:1.7.0' 47 implementation 'androidx.appcompat:appcompat:1.4.0' 48 implementation 'com.google.android.material:material:1.4.0' 49 implementation 'androidx.constraintlayout:constraintlayout:2.1.2' 50 implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5' 51 implementation 'androidx.navigation:navigation-ui-ktx:2.3.5' 52 testImplementation 'junit:junit:4.+' 53 androidTestImplementation 'androidx.test.ext:junit:1.1.3' 54 androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' 55}
kotlin
1 2//build.gradle(MyScheduler) 3 4// Top-level build file where you can add configuration options common to all sub-projects/modules. 5buildscript { 6 repositories { 7 google() 8 mavenCentral() 9 jcenter() 10 } 11 dependencies { 12 classpath "com.android.tools.build:gradle:4.2.2" 13 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10" 14 classpath "io.realm:realm-gradle-plugin:10.0.1" 15 16 // NOTE: Do not place your application dependencies here; they belong 17 // in the individual module build.gradle files 18 } 19} 20 21task clean(type: Delete) { 22 delete rootProject.buildDir 23}
試したこと
Realmの導入方法が変わっているようで、最初は別のエラーが出ていたのですが、
回避策としてbuildScriptにjcenter()を追加したところ、最初のエラーはなくなったのですが
記載のエラーが出てくるようになってしまいました。
(mavenCentral の Realm を使う方法が良いみたいですがやり方がわからず…。)
バージョンもいろいろ変えてみましたが、エラーは変わらずでした。
補足情報(FW/ツールのバージョンなど)
Android Studio Arctic Fox | 2020.3.1 Patch 4
あなたの回答
tips
プレビュー