android studio 使用realm后报错 apt替换成annotationProcessor,按照提示改了依旧没有效果。

一条老狗ˉ 2018-01-11 07:14:19
如图
...全文
1050 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
jklwan 2018-01-15
  • 打赏
  • 举报
回复
引用 4 楼 jklwan 的回复:
classpath "io.realm:realm-gradle-plugin:2.0.2"
改成
classpath "io.realm:realm-gradle-plugin:4.0.2"
2.0.2都是两年前的版本了
改成
classpath "io.realm:realm-gradle-plugin:4.3.1"
写错了,没有4.0.2
jklwan 2018-01-15
  • 打赏
  • 举报
回复
classpath "io.realm:realm-gradle-plugin:2.0.2"
改成
classpath "io.realm:realm-gradle-plugin:4.0.2"
2.0.2都是两年前的版本了 另外,你的butterknife版本要保持一致,不然可能出现问题

implementation 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
一条老狗ˉ 2018-01-15
  • 打赏
  • 举报
回复
引用
Error:Could not resolve all files for configuration ':app:debugAnnotationProcessorClasspath'. > Could not download javawriter.jar (com.squareup:javawriter:2.5.1) > Could not get resource 'https://jcenter.bintray.com/com/squareup/javawriter/2.5.1/javawriter-2.5.1.jar'. > Could not GET 'https://jcenter.bintray.com/com/squareup/javawriter/2.5.1/javawriter-2.5.1.jar'. > Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] failed: Connection timed out: connect
已经改好了,谢谢
jklwan 2018-01-15
  • 打赏
  • 举报
回复
引用 6 楼 zhaohuiyang_949 的回复:
我按照您的改了后,之前的那个错误没有了 但是又出现了新的错误,而且 我还看不懂,麻烦您再看看? 这是错误原因: Error:Could not resolve all files for configuration ':app:debugAnnotationProcessorClasspath'. > Could not download javawriter.jar (com.squareup:javawriter:2.5.1) > Could not get resource 'https://jcenter.bintray.com/com/squareup/javawriter/2.5.1/javawriter-2.5.1.jar'. > Could not GET 'https://jcenter.bintray.com/com/squareup/javawriter/2.5.1/javawriter-2.5.1.jar'. > Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] failed: Connection timed out: connect
这是连不上jcenter,试试能否打开https://jcenter.bintray.com/com/squareup/javawriter/2.5.1/ 不行的话加上国内阿里的库,

allprojects {
    repositories {
        jcenter()
        google()
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
    }
}
另外,你的support库最好保持版本一致

    implementation 'com.android.support:appcompat-v7:25.4.0'
    implementation 'com.android.support:cardview-v7:25.4.0'
    implementation 'com.android.support:recyclerview-v7:25.4.0'
一条老狗ˉ 2018-01-15
  • 打赏
  • 举报
回复
引用 5 楼 jklwan 的回复:
[quote=引用 4 楼 jklwan 的回复:]
classpath "io.realm:realm-gradle-plugin:2.0.2"
改成
classpath "io.realm:realm-gradle-plugin:4.0.2"
2.0.2都是两年前的版本了
改成
classpath "io.realm:realm-gradle-plugin:4.3.1"
写错了,没有4.0.2[/quote] 我按照您的改了后,之前的那个错误没有了 但是又出现了新的错误,而且 我还看不懂,麻烦您再看看? 这是错误原因: Error:Could not resolve all files for configuration ':app:debugAnnotationProcessorClasspath'. > Could not download javawriter.jar (com.squareup:javawriter:2.5.1) > Could not get resource 'https://jcenter.bintray.com/com/squareup/javawriter/2.5.1/javawriter-2.5.1.jar'. > Could not GET 'https://jcenter.bintray.com/com/squareup/javawriter/2.5.1/javawriter-2.5.1.jar'. > Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] failed: Connection timed out: connect
一条老狗ˉ 2018-01-12
  • 打赏
  • 举报
回复
之后 我新建了一个项目,发现只要添加了realm数据库就有错误。
apply plugin: 'realm-android'
一条老狗ˉ 2018-01-12
  • 打赏
  • 举报
回复
这是我两个gradle中代码 关于apt都删了 或者改了,还是没有效果。
apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "f3.nsu.com.habit"
        minSdkVersion 14
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

apply plugin: 'realm-android'
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:25.4.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    implementation 'de.greenrobot:eventbus:2.4.0'
    implementation 'com.jakewharton:butterknife:8.5.1'
    implementation 'com.wx.wheelview:wheelview:1.3.3'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
    implementation 'com.android.support:cardview-v7:25.3.1'
    implementation 'com.android.support:recyclerview-v7:25.1.1'
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath "io.realm:realm-gradle-plugin:2.0.2"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
moonFY 2018-01-12
  • 打赏
  • 举报
回复
apt 没有删干净吧,把root 目录下 和project 目录下的 build.gradle 里面的apt 都删了吧,apply plugin 和 classpath也 删了

80,349

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧