質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Realm

RealmとはSQLiteやCore Dataに代わるモバイルデータベースです。iOSとAndroidの両方でサポートされています。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Kotlin

Kotlinは、ジェットブレインズ社のアンドリー・ブレスラフ、ドミトリー・ジェメロフが開発した、 静的型付けのオブジェクト指向プログラミング言語です。

Q&A

解決済

1回答

3824閲覧

realmの導入をしたいのですがエラーが出てSyncが完了しません

Donsoku

総合スコア0

Realm

RealmとはSQLiteやCore Dataに代わるモバイルデータベースです。iOSとAndroidの両方でサポートされています。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Kotlin

Kotlinは、ジェットブレインズ社のアンドリー・ブレスラフ、ドミトリー・ジェメロフが開発した、 静的型付けのオブジェクト指向プログラミング言語です。

0グッド

0クリップ

投稿2021/12/12 09:32

realmの導入をしたいのですがエラーが出てSyncが完了しません

環境
Android studio Arctic Fox Patch3
Kotlin
最小API 21

以下のサイトを参考にrealmを導入しようとしています。
https://mo-gu-mo-gu.com/android-memo-app-tutorial/
root配下にある build.gradle にclasspath "io.realm:realm-gradle-plugin:6.0.0"を追記
app 配下にある build.gradle のpluginsに
id 'kotlin-android-extensions'
id 'kotlin-kapt'
id 'realm-android'
と追記し、Sync nowを押下したところエラーメッセージが出ました。

発生している問題・エラーメッセージ

A problem occurred configuring root project 'MemoSample'. > Could not resolve all artifacts for configuration ':classpath'. > Could not find io.realm:realm-gradle-plugin:6.0.0. Searched in the following locations: - https://dl.google.com/dl/android/maven2/io/realm/realm-gradle-plugin/6.0.0/realm-gradle-plugin-6.0.0.pom - https://repo.maven.apache.org/maven2/io/realm/realm-gradle-plugin/6.0.0/realm-gradle-plugin-6.0.0.pom Required by: project : Possible solution: - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

該当のソースコード

root配下にある build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() mavenCentral() } dependencies { classpath "com.android.tools.build:gradle:7.0.3" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0" classpath "io.realm:realm-gradle-plugin:6.0.0" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } task clean(type: Delete) { delete rootProject.buildDir }

app 配下にある build.gradle

plugins { id 'com.android.application' id 'kotlin-android' id 'kotlin-android-extensions' id 'kotlin-kapt' id 'realm-android' } android { compileSdk 31 defaultConfig { applicationId "com.donsoku.android.memosample" minSdk 21 targetSdk 31 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' } } dependencies { implementation 'androidx.core:core-ktx:1.7.0' implementation 'androidx.appcompat:appcompat:1.4.0' implementation 'com.google.android.material:material:1.4.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.2' testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' }

試したこと

root配下にある build.gradleの該当パスを6.0.0から6.0.2に変更したり
app 配下にある build.gradleのpluginsの箇所を参考サイト通りに変更してみたのですが、
解決できませんでした。
翻訳したエラーメッセージに「ルートプロジェクト「MemoSample」の設定で問題が発生しました。

構成 ':classpath'のすべてのアーティファクトを解決できませんでした。
io.realm:realm-gradle-plugin:6.0.0が見つかりませんでした。

次の場所で検索されました。」とあることから、classPathがおかしいのかと思いますが、対応策が見つかりませんでした。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

hoshi-takanori

2021/12/12 09:45

Realm 最新版を使えば良いのでは…。
Donsoku

2021/12/12 10:48

たぶん自己解決しました。 Android studio のヴァージョンが更新されたことでjcenterが利用できなくなったことにより、 (このバージョンの?)realmが使えなくなったこと原因と思われます。 Android studio でjcenterを記載したときに取り消し線状態になったので。 https://qiita.com/tobiyamukunn118/items/7c6405bf0b00c04b6c9e
guest

回答1

0

自己解決

たぶん自己解決しました。
Android studio のヴァージョンが更新されたことでjcenterが利用できなくなったことにより、
(このバージョンの?)realmが使えなくなったこと原因と思われます。
Android studio でjcenterを記載したときに取り消し線状態になったので。
https://qiita.com/tobiyamukunn118/items/7c6405bf0b00c04b6c9e

投稿2021/12/12 11:12

Donsoku

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問