今天遇到的编译时报错:
Error:Execution failed for task ':gov:transformClassesWithInstantRunForDebug'.
> java.lang.ClassNotFoundException: io.realm.RealmObject
Gradle Console:
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:gov:clean
:gov:preBuild UP-TO-DATE
:gov:preDebugBuild UP-TO-DATE
:gov:checkDebugManifest
:MPChartLib:preBuild UP-TO-DATE
:MPChartLib:preReleaseBuild UP-TO-DATE
:MPChartLib:compileReleaseNdk UP-TO-DATE
:MPChartLib:compileLint
:MPChartLib:copyReleaseLint UP-TO-DATE
:MPChartLib:mergeReleaseProguardFiles UP-TO-DATE
:MPChartLib:packageReleaseRenderscript UP-TO-DATE
:MPChartLib:checkReleaseManifest
:MPChartLib:prepareReleaseDependencies
:MPChartLib:compileReleaseRenderscript UP-TO-DATE
:MPChartLib:generateReleaseResValues UP-TO-DATE
:MPChartLib:generateReleaseResources UP-TO-DATE
:MPChartLib:packageReleaseResources UP-TO-DATE
:MPChartLib:compileReleaseAidl UP-TO-DATE
:MPChartLib:generateReleaseBuildConfig UP-TO-DATE
:MPChartLib:mergeReleaseShaders UP-TO-DATE
:MPChartLib:compileReleaseShaders UP-TO-DATE
:MPChartLib:generateReleaseAssets UP-TO-DATE
:MPChartLib:mergeReleaseAssets UP-TO-DATE
:MPChartLib:processReleaseManifest UP-TO-DATE
:MPChartLib:processReleaseResources
:MPChartLib:generateReleaseSources
:MPChartLib:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:MPChartLib:compileReleaseJavaWithJavac UP-TO-DATE
:MPChartLib:processReleaseJavaRes UP-TO-DATE
:MPChartLib:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:MPChartLib:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
:MPChartLib:mergeReleaseJniLibFolders UP-TO-DATE
:MPChartLib:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:MPChartLib:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
:MPChartLib:bundleRelease UP-TO-DATE
:common:preBuild UP-TO-DATE
:common:preReleaseBuild UP-TO-DATE
:common:compileReleaseNdk UP-TO-DATE
:common:compileLint
:common:copyReleaseLint UP-TO-DATE
:common:checkReleaseManifest
:common:preDebugAndroidTestBuild UP-TO-DATE
:common:preDebugBuild UP-TO-DATE
:common:preDebugUnitTestBuild UP-TO-DATE
:common:preReleaseUnitTestBuild UP-TO-DATE
:common:prepareComAndroidSupportAnimatedVectorDrawable2340Library UP-TO-DATE
:common:prepareComAndroidSupportAppcompatV72340Library UP-TO-DATE
:common:prepareComAndroidSupportSupportV42340Library UP-TO-DATE
:common:prepareComAndroidSupportSupportVectorDrawable2340Library UP-TO-DATE
:common:prepareReleaseDependencies
:common:compileReleaseAidl UP-TO-DATE
:common:compileReleaseRenderscript UP-TO-DATE
:common:generateReleaseBuildConfig UP-TO-DATE
:common:mergeReleaseShaders UP-TO-DATE
:common:compileReleaseShaders UP-TO-DATE
:common:generateReleaseAssets UP-TO-DATE
:common:mergeReleaseAssets UP-TO-DATE
:common:generateReleaseResValues UP-TO-DATE
:common:generateReleaseResources UP-TO-DATE
:common:mergeReleaseResources UP-TO-DATE
:common:processReleaseManifest UP-TO-DATE
:common:processReleaseResources
:common:generateReleaseSources
:common:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:common:compileReleaseJavaWithJavac UP-TO-DATE
:common:extractReleaseAnnotations UP-TO-DATE
:common:mergeReleaseProguardFiles UP-TO-DATE
:common:packageReleaseRenderscript UP-TO-DATE
:common:packageReleaseResources UP-TO-DATE
:common:processReleaseJavaRes UP-TO-DATE
:common:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:common:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
:common:mergeReleaseJniLibFolders UP-TO-DATE
:common:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:common:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
:common:bundleRelease UP-TO-DATE
:gov:preReleaseBuild UP-TO-DATE
:gov:prepareComAndroidSupportAnimatedVectorDrawable2340Library
:gov:prepareComAndroidSupportAppcompatV72340Library
:gov:prepareComAndroidSupportCardviewV72340Library
:gov:prepareComAndroidSupportDesign2340Library
:gov:prepareComAndroidSupportRecyclerviewV72340Library
:gov:prepareComAndroidSupportSupportV42340Library
:gov:prepareComAndroidSupportSupportVectorDrawable2340Library
:gov:prepareComRoughikeBottomBar133Library
:gov:prepareHomeCareProMasterCommonUnspecifiedLibrary
:gov:prepareHomeCareProMasterMPChartLibUnspecifiedLibrary
:gov:prepareDebugDependencies
:gov:compileDebugAidl
:gov:compileDebugRenderscript
:gov:generateDebugBuildConfig
:gov:mergeDebugShaders
:gov:compileDebugShaders
:gov:generateDebugAssets
:gov:mergeDebugAssets
:gov:generateDebugResValues UP-TO-DATE
:gov:generateDebugResources
:gov:mergeDebugResources
:gov:processDebugManifest
:gov:processDebugResources
:gov:generateDebugSources
:gov:mockableAndroidJar UP-TO-DATE
:gov:preDebugUnitTestBuild UP-TO-DATE
:gov:prepareDebugUnitTestDependencies
:gov:preDebugAndroidTestBuild UP-TO-DATE
:gov:prepareDebugAndroidTestDependencies
:gov:compileDebugAndroidTestAidl
:gov:processDebugAndroidTestManifest
:gov:compileDebugAndroidTestRenderscript
:gov:generateDebugAndroidTestBuildConfig
:gov:mergeDebugAndroidTestShaders
:gov:compileDebugAndroidTestShaders
:gov:generateDebugAndroidTestAssets
:gov:mergeDebugAndroidTestAssets
:gov:generateDebugAndroidTestResValues UP-TO-DATE
:gov:generateDebugAndroidTestResources
:gov:mergeDebugAndroidTestResources
:gov:processDebugAndroidTestResources
:gov:generateDebugAndroidTestSources
:gov:incrementalDebugJavaCompilationSafeguard
:gov:compileDebugJavaWithJavac
:gov:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
注: D:\Android\...\StatisticsPresenter.java使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
:gov:compileDebugNdk UP-TO-DATE
:gov:compileDebugSources
:gov:buildInfoDebugLoader
:gov:transformClassesWithExtractJarsForDebug
:gov:transformClassesWithInstantRunVerifierForDebug
:gov:transformClassesWithJavaResourcesVerifierForDebug
:gov:mergeDebugJniLibFolders
:gov:transformNative_libsWithMergeJniLibsForDebug
:gov:processDebugJavaRes UP-TO-DATE
:gov:transformResourcesWithMergeJavaResForDebug
:gov:transformResourcesAndNative_libsWithJavaResourcesVerifierForDebug
:gov:transformClassesWithInstantRunForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':gov:transformClassesWithInstantRunForDebug'.
> java.lang.ClassNotFoundException: io.realm.RealmObject
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
-----------------------------------------------------------------------------------------------------------------------
原因:
更新到 Android Studio 2.0 以后的新特性:instant run 即使运行功能 (.......)
解决方案:
settings -> Build,Execution,Deployment ->Instant Run -> Enable Instant Run ... 去掉勾选
网友评论