【问题标题】:Android - Getting multiple errors while building the projectAndroid - 构建项目时出现多个错误
【发布时间】:2018-06-11 07:38:40
【问题描述】:

我在构建项目时遇到这些错误

  1. 未能解决:firebase-core
  2. 无法解析:multidex
  3. 无法解决:播放服务广告
  4. 无法解决:play-services-auth
  5. 未能解决:firebase-auth-license
  6. 无法解决:常见

请检查并告诉我如何解决此问题?

plugins {
    id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.test.android"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 3
        versionName "1.0.2"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
        manifestPlaceholders = [onesignal_app_id : "65f11821-8462-4ec4-9e41-XXXXXXXX",
                                // Project number pulled from dashboard, local value is ignored.
                                onesignal_google_project_number: "91629XXXXX00"]
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
}

dependencies {
    implementation 'com.google.firebase:firebase-auth:11.6.0'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    // applovin
    implementation project(':unity-ads')
    //unity ads
    //compile 'com.google.android.gms:play-services-ads:11.0.4'
    implementation 'com.android.support:appcompat-v7:26.+'
    implementation 'com.android.support:design:26.+'
    implementation 'com.android.support:support-vector-drawable:26.+'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-v4:26.+'
    implementation 'com.google.android.gms:play-services:11.6.0'
    implementation 'com.android.support:multidex:1.0.1'
    //compile 'com.github.cooltechworks:ScratchView:v1.1'//not used
    implementation 'com.jackpocket:scratchoff:1.1.0'
    implementation 'com.adcolony:sdk:3.2.1'
    implementation 'com.android.support:support-annotations:26.0.1'
    implementation 'com.google.android.gms:play-services-ads:11.6.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.facebook.android:facebook-share:[4,5)'
    testImplementation 'junit:junit:4.12'
    implementation 'com.ironsource.sdk:mediationsdk:6.7.0.1@jar'
    //compile 'com.google.ads.mediation:unity:2.1.1.0' //not used
    implementation 'com.google.firebase:firebase-database:11.6.0'
    implementation 'com.github.bumptech.glide:glide:4.1.1'
    implementation 'commons-net:commons-net:3.3'
    //get server time
    //compile 'com.github.instacart.truetime-android:library-extension-rx:2.0'
    //compile 'com.github.instacart.truetime-android:library:2.0' // not used
    implementation 'com.google.firebase:firebase-auth:11.6.0'
    implementation 'com.google.firebase:firebase-core:11.6.0'
    implementation 'com.google.android.gms:play-services-auth:11.6.0'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.onesignal:OneSignal:[3.7.1, 3.99.99]'
    implementation files('libs/applovin-sdk-7.7.0-javadoc.jar')
    implementation files('libs/applovin-sdk-7.7.0.jar')
}
apply plugin: 'com.google.gms.google-services'

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

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0-alpha09'
        classpath 'com.google.gms:google-services:3.1.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://maven.google.com" }
        maven { url "https://jitpack.io" }
        maven { url  "https://adcolony.bintray.com/AdColony" }
        maven { url "https://dl.bintray.com/ironsource-mobile/android-sdk" }
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

【问题讨论】:

    标签: android android-gradle-plugin build.gradle


    【解决方案1】:

    显然,jcenter has started mirroring Google's repo。尝试在项目build.gradleallprojects 部分中将google() 移动到jcenter() 之前(像这样):

    repositories {
        google()
        jcenter()
        maven { url "https://maven.google.com" }
        maven { url "https://jitpack.io" }
        maven { url  "https://adcolony.bintray.com/AdColony" }
        maven { url "https://dl.bintray.com/ironsource-mobile/android-sdk" }
    }
    

    【讨论】:

      【解决方案2】:

      您是否尝试过重建应用程序?还要确保您使用的是最新版本的 GMS。作为旁注,您不需要添加整个 gms 库,您可以添加选择性服务。我看到您添加了 gms- 和 gms-ads,它们已经包含在主 gms 中。

      【讨论】:

      • 是的,我尝试重建应用程序,但仍然会出现错误。我没听懂你的 gms 点...请详细说明。
      • 关于 gms 的 2 点:您需要将其更新到最新版本,并且最好只使用您需要的 gms 模块而不是整个库,因为这样会节省一些空间。我看到您正在使用整个 gms 库的过时版本及其子模块之一的过时版本。查看此链接:stackoverflow.com/questions/41258616/…
      猜你喜欢
      • 1970-01-01
      • 2019-03-30
      • 2015-12-09
      • 2019-08-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-25
      • 2019-02-03
      相关资源
      最近更新 更多