Meituan-Dianping / Robust

Robust is an Android HotFix solution with high compatibility and high stability. Robust can fix bugs immediately without a reboot.
Apache License 2.0
4.42k stars 807 forks source link

签名打包时出现java.lang.RuntimeException #242

Closed dhh940827 closed 6 years ago

dhh940827 commented 6 years ago

异常类型:编译异常

Robust版本:0.4.75

Gradle版本:4.1

系统:window

堆栈/日志:通过使用gradlew clean assembleRelease --stacktrace --no-daemon >log.txt 打包后显示java.lang.RuntimeException: Unexpected scopes found in folder 'F:\shareproject\ActivityResearch\app\build\intermediates\transforms\robust\release'. Required: PROJECT. Found: EXTERNAL_LIBRARIES, PROJECT, SUB_PROJECTS。而作为安卓新手的我只是刚开始使用robust,我的项目gradle,appgradle如下 apply plugin: 'com.android.application' //制作补丁时将这个打开,auto-patch-plugin紧跟着com.android.application //apply plugin: 'auto-patch-plugin' apply plugin: 'robust' apply plugin: 'realm-android' apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 26 defaultConfig { applicationId "hua.yukari.com.activityresearch" minSdkVersion 21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { //添加stetho-realm代码仓库地址 maven { url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo' } } realm { syncEnabled = true // kotlinExtensionsEnabled = true } tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { kotlinOptions { freeCompilerArgs = ["-Xjsr305=strict"] } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" compile "io.realm:realm-annotations:3.0.0" kapt "io.realm:realm-annotations:3.0.0" kapt "io.realm:realm-annotations-processor:3.0.0" implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support:design:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.android.support:cardview-v7:26.1.0' implementation 'com.facebook.stetho:stetho:1.5.0' implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0' implementation 'com.uphyca:stetho_realm:2.0.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' compile 'com.facebook.stetho:stetho:1.4.1' //添加这两行 compile 'com.uphyca:stetho_realm:2.0.0' compile 'com.meituan.robust:robust:0.4.75' } 项目gradle: buildscript { ext.kotlin_version = '1.1.51' repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'io.realm:realm-gradle-plugin:3.0.0' classpath 'com.meituan.robust:gradle-plugin:0.4.75' classpath 'com.meituan.robust:auto-patch-plugin:0.4.75'

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

}

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

task clean(type: Delete) { delete rootProject.buildDir } 求解决问题,新手初学热修复,求指教! log default

dhh940827 commented 6 years ago

该问题已解决,apply plugin: 'realm-android'必须放在apply plugin: 'robust'之上,否则会打包出错

hedex commented 6 years ago

chenfd99 commented 6 years ago

同样适用于 transformClassesWithObjectBoxAndroidTransformForRelease 这个错

apply plugin: 'io.objectbox' apply plugin: 'robust'

robust放在io.objectbox下面解决

lifs419 commented 4 years ago

该问题已解决,apply plugin: 'realm-android'必须放在apply plugin: 'robust'之上,否则会打包出错 先后顺序 调整有什么影响呢?