android - 从 1.5 升级后,应用程序无法在 Android Studio 2.0 下运行

标签 android gradle android-studio-2.0

我最近将我的 Android Studio 从 1.5 升级到了 2.0。我的应用程序可以在 Android 1.5 上正常构建和运行。现在,当我尝试在我的智能手机上运行该应用程序时,它给了我这个错误:

Error:Execution failed for task ':app:transformClassesWithInstantRunForDebug'.
> 24

当我在 Android Studio 2.0 上打开我的项目时,出现了一个消息框,告诉我将我的 gradle 升级到版本 2,我照做了。我不确定为什么会收到此错误。

这是我尝试在手机上运行应用程序时得到的输出:

Executing tasks: [clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugUnitTestSources, :app:compileDebugAndroidTestSources]
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:clean UP-TO-DATE
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2321Library
:app:prepareComAndroidSupportAppcompatV72321Library
:app:prepareComAndroidSupportCardviewV72321Library
:app:prepareComAndroidSupportDesign2321Library
:app:prepareComAndroidSupportMediarouterV72300Library
:app:prepareComAndroidSupportRecyclerviewV72321Library
:app:prepareComAndroidSupportSupportV42321Library
:app:prepareComAndroidSupportSupportVectorDrawable2321Library
:app:prepareComGoogleAndroidGmsPlayServices840Library
:app:prepareComGoogleAndroidGmsPlayServicesAds840Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics840Library
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing840Library
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite840Library
:app:prepareComGoogleAndroidGmsPlayServicesAppstate840Library
:app:prepareComGoogleAndroidGmsPlayServicesAuth840Library
:app:prepareComGoogleAndroidGmsPlayServicesBase840Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement840Library
:app:prepareComGoogleAndroidGmsPlayServicesCast840Library
:app:prepareComGoogleAndroidGmsPlayServicesDrive840Library
:app:prepareComGoogleAndroidGmsPlayServicesFitness840Library
:app:prepareComGoogleAndroidGmsPlayServicesGames840Library
:app:prepareComGoogleAndroidGmsPlayServicesGcm840Library
:app:prepareComGoogleAndroidGmsPlayServicesIdentity840Library
:app:prepareComGoogleAndroidGmsPlayServicesLocation840Library
:app:prepareComGoogleAndroidGmsPlayServicesMaps840Library
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library
:app:prepareComGoogleAndroidGmsPlayServicesNearby840Library
:app:prepareComGoogleAndroidGmsPlayServicesPanorama840Library
:app:prepareComGoogleAndroidGmsPlayServicesPlus840Library
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet840Library
:app:prepareComGoogleAndroidGmsPlayServicesVision840Library
:app:prepareComGoogleAndroidGmsPlayServicesWallet840Library
:app:prepareComGoogleAndroidGmsPlayServicesWearable840Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:mockableAndroidJar
:app:preDebugUnitTestBuild UP-TO-DATE
:app:prepareDebugUnitTestDependencies
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl
:app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:generateDebugAndroidTestAssets UP-TO-DATE
:app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
:app:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:compileDebugUnitTestJavaWithJavac
:app:processDebugJavaRes UP-TO-DATE
:app:processDebugUnitTestJavaRes UP-TO-DATE
:app:compileDebugUnitTestSources
:app:compileDebugAndroidTestJavaWithJavac
:app:compileDebugAndroidTestNdk UP-TO-DATE
:app:compileDebugAndroidTestSources

BUILD SUCCESSFUL

Total time: 1 mins 31.987 secs
Executing tasks: [:app:clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:assembleDebug]

Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2321Library
:app:prepareComAndroidSupportAppcompatV72321Library
:app:prepareComAndroidSupportCardviewV72321Library
:app:prepareComAndroidSupportDesign2321Library
:app:prepareComAndroidSupportMediarouterV72300Library
:app:prepareComAndroidSupportRecyclerviewV72321Library
:app:prepareComAndroidSupportSupportV42321Library
:app:prepareComAndroidSupportSupportVectorDrawable2321Library
:app:prepareComGoogleAndroidGmsPlayServices840Library
:app:prepareComGoogleAndroidGmsPlayServicesAds840Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics840Library
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing840Library
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite840Library
:app:prepareComGoogleAndroidGmsPlayServicesAppstate840Library
:app:prepareComGoogleAndroidGmsPlayServicesAuth840Library
:app:prepareComGoogleAndroidGmsPlayServicesBase840Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement840Library
:app:prepareComGoogleAndroidGmsPlayServicesCast840Library
:app:prepareComGoogleAndroidGmsPlayServicesDrive840Library
:app:prepareComGoogleAndroidGmsPlayServicesFitness840Library
:app:prepareComGoogleAndroidGmsPlayServicesGames840Library
:app:prepareComGoogleAndroidGmsPlayServicesGcm840Library
:app:prepareComGoogleAndroidGmsPlayServicesIdentity840Library
:app:prepareComGoogleAndroidGmsPlayServicesLocation840Library
:app:prepareComGoogleAndroidGmsPlayServicesMaps840Library
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library
:app:prepareComGoogleAndroidGmsPlayServicesNearby840Library
:app:prepareComGoogleAndroidGmsPlayServicesPanorama840Library
:app:prepareComGoogleAndroidGmsPlayServicesPlus840Library
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet840Library
:app:prepareComGoogleAndroidGmsPlayServicesVision840Library
:app:prepareComGoogleAndroidGmsPlayServicesWallet840Library
:app:prepareComGoogleAndroidGmsPlayServicesWearable840Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:mockableAndroidJar UP-TO-DATE
:app:preDebugUnitTestBuild UP-TO-DATE
:app:prepareDebugUnitTestDependencies
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl
:app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:generateDebugAndroidTestAssets UP-TO-DATE
:app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
:app:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:buildInfoDebugLoader
:app:transformClassesWithExtractJarsForDebug
:app:transformClassesWithInstantRunVerifierForDebug
:app:transformClassesWithJavaResourcesVerifierForDebug
:app:mergeDebugJniLibFolders
:app:transformNative_libsWithMergeJniLibsForDebug
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug
:app:transformResourcesAndNative_libsWithJavaResourcesVerifierForDebug UP-TO-DATE
:app:transformClassesWithInstantRunForDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithInstantRunForDebug'.
> 24

* Try:

最佳答案

尝试禁用 Android Studio 2.0 中的 Instant Run 选项

这对我有帮助。

关于android - 从 1.5 升级后,应用程序无法在 Android Studio 2.0 下运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36511018/

相关文章:

android - android studio 和 eclipse 的 SDK 管理器可以相同吗?

Android调试器怪异

java - 如何将添加添加到我们的 Android 应用程序中

java - 在Android中设置一个字符串,记录该字符串,空指针

Gradle插件DSL : Restriction on declaration location

build - 如何使用多个 build.gradle 文件?

c - 迁移到实验性 gradle Android Studio 2.0+ 时包含的问题

android - Koin 未找到类的定义,但已声明

plugins - 如何在 gradle findbugs 插件中将报告的错误打印到控制台?

具有相同功能的多个项目的 Android 模块结构