简体   繁体   English

无法在Android Studio 2.0预览版中启动该应用

[英]Can't launch the app in Android Studio 2.0 Preview

MY gradle is 我的朋友是

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
        classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
        }
}

allprojects {
    repositories {
        mavenCentral()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
        maven {
            url 'http://dl.bintray.com/amulyakhare/maven'
        }
    }
}

app gradle is app gradle是

buildscript {
    repositories {
        maven {
            url 'https://maven.fabric.io/public'
        }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.19.2'
    }
}
apply plugin: 'com.android.application'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url "https://clojars.org/repo/"}
    maven { url "https://s3.amazonaws.com/repo.commonsware.com" }

}

apply plugin: 'com.jakewharton.hugo'
apply plugin: 'io.fabric'


android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'

    defaultConfig {
        applicationId "***.***"
        minSdkVersion 14
        targetSdkVersion 22
        versionCode 5
        versionName "1.5"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }

    signingConfigs {
        release {
            storeFile file('../keystore.jks')
            storePassword "***"
            keyAlias '***'
            keyPassword "***"
        }
    }

    buildTypes {
        debug {
            debuggable true
            zipAlignEnabled true
            signingConfig signingConfigs.release
            minifyEnabled false
        }
        release {
            debuggable false
            minifyEnabled false
            signingConfig signingConfigs.release
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.parse:parsetwitterutils-android:1.10.3'
    compile 'com.parse:parse-android:1.+'
    compile 'jp.wasabeef:picasso-transformations:1.3.0'
    compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.3.0'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.octo.android.robospice:robospice:1.4.14'
    compile 'io.reactivex:rxjava:1.0.14'
    compile 'io.reactivex:rxandroid:0.25.0'
    compile 'de.greenrobot:eventbus:2.4.0'
    compile 'com.github.snowdream.android.util:log:1.2.0'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
        transitive = true;
    }
    compile('com.digits.sdk.android:digits:1.9.1@aar') {
        transitive = true;
    }
    /*    compile 'frankiesardo:icepick:3.0.2'
                        provided 'frankiesardo:icepick-processor:3.0.2'*/
    compile 'org.parceler:parceler-api:1.0.1'
    provided 'org.parceler:parceler:1.0.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'org.scribe:scribe:1.3.6'
    compile 'com.android.support:support-v13:23.1.1'
    compile 'com.facebook.android:facebook-android-sdk:4.1.0'
    compile 'com.pushtorefresh.storio:content-resolver:1.0.1'
    compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
    compile 'com.pkmmte.view:circularimageview:1.1'
    compile 'com.baoyz.pullrefreshlayout:library:1.0.1'
    compile 'com.commonsware.cwac:merge:1.1.+'//adapger merger for listview with two adapters
    compile 'com.google.android.gms:play-services-location:8.3.0'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
}

When I try to launch the app in Android Studio 2.0 Preview the following message is in Message window: 当我尝试在Android Studio 2.0 Preview中启动应用程序时,以下消息位于“消息”窗口中:

Information:Gradle tasks [:app:assembleDebug]
:app:incrementalDebugBuildInfoGenerator
:app:preBuild UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAmulyakhareComAmulyakhareTextdrawable101Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV132311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:app:prepareComBaoyzPullrefreshlayoutLibrary101Library UP-TO-DATE
:app:prepareComCommonswareCwacMerge111Library UP-TO-DATE
:app:prepareComCommonswareCwacSacklist102Library UP-TO-DATE
:app:prepareComCrashlyticsSdkAndroidAnswers132Library UP-TO-DATE
:app:prepareComCrashlyticsSdkAndroidBeta113Library UP-TO-DATE
:app:prepareComCrashlyticsSdkAndroidCrashlytics252Library UP-TO-DATE
:app:prepareComCrashlyticsSdkAndroidCrashlyticsCore235Library UP-TO-DATE
:app:prepareComDigitsSdkAndroidDigits191Library UP-TO-DATE
:app:prepareComFacebookAndroidFacebookAndroidSdk410Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps830Library UP-TO-DATE
:app:prepareComJakewhartonHugoHugoRuntime121Library UP-TO-DATE
:app:prepareComPkmmteViewCircularimageview11Library UP-TO-DATE
:app:prepareComTwitterSdkAndroidTwitterCore161Library UP-TO-DATE
:app:prepareIoFabricSdkAndroidFabric137Library UP-TO-DATE
:app:prepareJpWasabeefPicassoTransformations130Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:processDebugManifest
:app:injectDebugBootstrap
Instrumented adam.youpick.common.YouPickApp with fast deploy
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:crashlyticsGenerateResourcesDebug
:app:processDebugResources
:app:generateDebugSources
:app:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:fastDeployDebugExtractor
:app:generateDebugInstantRunAppInfo
:app:transformClassesWithInstantRunVerifierForDebug
:app:transformClassesWithInstantRunForDebug
IncrementalSupportVisitor Visiting adam/youpick/BuildConfig
IncrementalSupportVisitor Visiting adam/youpick/FragmentStack
... //HERE IS MANY ERRORS ABOUT "IncrementalSupportVisitor Visiting"
IncrementalSupportVisitor Visiting adam/youpick/serviceLayer/network/api/yelp/model/YelpRequest
:app:transformClassesWithInstant+restartDexForDebug
:app:transformClasses_enhancedWithInstant+reloadDexForDebug
:app:incrementalDebugSupportDex
:app:transformClassesWithDexForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_66\bin\java.exe'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 3 mins 9.804 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

UPDATE: 更新:

But with classpath 'com.android.tools.build:gradle:1.2.3' the app runs correctly 但是使用classpath 'com.android.tools.build:gradle:1.2.3' ,应用程序可以正常运行

How to solve error: IncrementalSupportVisitor Visiting with gradle:2.0.0-alpha1 ? 如何解决错误: IncrementalSupportVisitor Visiting使用gradle:2.0.0-alpha1 IncrementalSupportVisitor Visiting gradle:2.0.0-alpha1

From the documentation : 文档

Here are also some known issues that we are working on: Apps that are using legacy multi-dex (with minSdkVersion < 21), with a main dex file near the 65K method limit may not build. 以下是我们正在处理的一些已知问题:使用传统multi-dex(使用minSdkVersion <21)的应用程序,以及接近65K方法限制的主dex文件可能无法构建。 This would require reworking the app to make room in the main dex list by reducing the number of classes required in the main dex file. 这需要通过减少主dex文件中所需的类数来重新处理应用程序以在主dex列表中腾出空间。

It seem "Instant Run" don't work with Multi-dex pre 21. 似乎“即时运行”不适用于Multi-dex pre 21。

So don't use gradle:2.0.0-alpha1 所以不要使用gradle:2.0.0-alpha1

I have the same error before, I solved the error by updating 之前我有同样的错误,我通过更新解决了错误

targetSdkVersion = 23

also I am using 我也在使用

classpath 'com.android.tools.build:gradle:2.0.0-alpha5'

with Android Studio Preview 5 使用Android Studio Preview 5

You can add multiDexEnabled true in defaultConfig 您可以在defaultConfig中添加multiDexEnabled true

 defaultConfig {
 multiDexEnabled true
 }

I had the same problem with my Android Studio 2.0 version and I fixed that by updating the Gradle Plugin into newest version. 我的Android Studio 2.0版本遇到了同样的问题,我通过将Gradle插件更新为最新版本来解决这个问题。 Here is the way you can update it into latest version 以下是将其更新为最新版本的方法

nstant Run is enabled by default for projects built using Android Gradle Plugin 2.0.0, or later. 对于使用Android Gradle Plugin 2.0.0或更高版本构建的项目,默认情况下启用nstant Run。 To update an existing project with the latest version of the Gradle plugin, go to the Settings dialog: 要使用最新版本的Gradle插件更新现有项目,请转到“设置”对话框:

On Mac, click Android Studio → Preferences

On Windows and Linux, click File → Settings

In the Settings/Preferences dialog, go to Build, Execution, Deployment → Instant Run. 在“设置/首选项”对话框中,转到“构建”,“执行”,“部署”→“即时运行”。 Click the Update Project link. 单击“更新项目”链接。 When prompted, click OK. 出现提示时,单击“确定”

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM