首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >解析失败:普通Android Studio

解析失败:普通Android Studio
EN

Stack Overflow用户
提问于 2018-06-10 02:29:39
回答 1查看 2K关注 0票数 0

我最近在gradle build/sync上收到这个错误消息:

Image of the Error

当我点击“打开文件”时,它会切换到build.gradle (应用程序)窗口。

我在stackoverflow上没有得到任何解决方案。请检查代码并让我知道问题所在。

我真的很感谢你的帮助。

build.gradle (项目)

代码语言:javascript
复制
    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        mavenCentral()
        jcenter()
        google()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        classpath 'com.google.gms:google-services:3.3.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://jitpack.io"
        }
        maven {

            url "https://maven.google.com" // Google's Maven repository
        }
        google()
    }


    dependencies {

        /*compile('javax.inject:javax.inject:1',
                'com.google.dagger:dagger:2.7',
                'de.greenrobot:eventbus:2.2.1',
                'io.reactivex:rxjava:1.2.0',
                'io.reactivex:rxandroid:1.2.1')

        compile files('libs/publisher-sdk-android-5.1.0.jar')*/

    }
}

build.gradle (应用程序)

代码语言:javascript
复制
 apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.appname"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        //multiDexEnabled = false
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }
    }
    /*lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }*/


}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //noinspection GradleCompatible


    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.1'
    implementation 'com.android.support:support-v4:27.1.1'

    // Vungle SDK
    //implementation 'com.github.vungle:vungle-android-sdk:6.2.5'
    // Optional Google Play Services - Location and Basement
    implementation 'com.google.android.gms:play-services-location:15.0.1'

    implementation 'com.google.android.gms:play-services-ads:15.0.1'

    //Replace it with Google Analytics?
    implementation 'com.google.firebase:firebase-core:16.0.0'

    implementation 'com.google.firebase:firebase-auth:16.0.1'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-database:16.0.1'

    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.10'
    implementation 'org.jsoup:jsoup:1.8.3'
    implementation 'com.github.simbiose:Encryption:2.0.1'
    testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-06-10 02:40:21

使用这些

先检查一下

转到Settings/Preferences > Build,Execution,Deployment option > Instant Run并取消选中所有三个框。

1。升级Gradle服务URL:

项目> Gradle >包装器> gradle-wrapper.properties

将URL更改为

代码语言:javascript
复制
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 

代码语言:javascript
复制
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip

(请在此处找到最新的distributionUrl gradle插件版本:http://services.gradle.org/distributions

**确保使用gradle-x.xx-all.zip )

2。删除build文件夹

运行项目时,将自动创建生成文件夹

3。进入菜单>清理项目中的生成选项,生成项目

它应该在没有即时运行的情况下工作。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50777348

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档