错误:使用react-native-intercom

时间:2018-11-14 21:29:28

标签: android react-native gradle intercom

我的项目在2天前编译良好,但昨天和今天整天似乎无法构建android应用。

我已经尝试从2年前撤回我的仓库,但仍然遇到相同的构建错误。 iOS版本运行良好。

该版本以前是26,但是为了让构建顺利进行,我更改了它们。我认为重复的特定依赖项在我执行此操作后发生了变化,但是否则这些文件或多或少与我开始尝试使其工作之前一样。

老实说,我无法采取我尝试过的所有步骤,因为它已经出现了google / stackoverflow / github问题2天,并在那儿遵循了建议-其中大部分涉及到像我一样升级sdk版本。

任何包含对讲的提交都具有相同的问题构建,但是直到两天前,我还没有与对讲构建任何问题。

这是我的react-native run-android输出的最后两行:

:react-native-intercom:processReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-intercom:processReleaseResources'.
> Error: more than one library with package name 'android.support.graphics.drawable'

我的android / build.gradle:

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

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

}

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 28
                buildToolsVersion '28.0.0'
            }
        }
    }
}


allprojects {
  repositories {
      mavenLocal()
      jcenter()
      maven {
          // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
          url "$rootDir/../node_modules/react-native/android"
      }
      maven { url 'https://maven.google.com' }
  }
}

我的android / app / build.gradle:

apply plugin: "com.android.application"

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

    dependencies {
        // These docs use an open ended version so that our plugin
        // can be updated quickly in response to Android tooling updates

        // We recommend changing it to the latest version from our changelog:
        // https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

apply plugin: "com.android.application"
apply plugin: 'io.fabric'
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

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

import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations
 * and their defaults. If you decide to add a configuration block, make sure to add it before the
 * `apply from: "../../node_modules/react-native/react.gradle"` line.
 *
 * project.ext.react = [
 *   // the name of the generated asset file containing your JS bundle
 *   bundleAssetName: "index.android.bundle",
 *
 *   // the entry file for bundle generation
 *   entryFile: "index.android.js",
 *
 *   // whether to bundle JS and assets in debug mode
 *   bundleInDebug: false,
 *
 *   // whether to bundle JS and assets in release mode
 *   bundleInRelease: true,
 *
 *   // whether to bundle JS and assets in another build variant (if configured).
 *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // whether to disable dev mode in custom build variants (by default only disabled in release)
 *   // for example: to disable dev mode in the staging build type (if configured)
 *   devDisabledInStaging: true,
 *   // The configuration property can be in the following formats
 *   //         'devDisabledIn${productFlavor}${buildType}'
 *   //         'devDisabledIn${buildType}'
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"],
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */

project.ext.react = [
    entryFile: "index.js"
]

project.ext.versionName = "1.0.0"

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

def generateVersionCode(){
  def value = System.getenv('APP_VERSION_CODE')
  if( value == null || value.length() < 1 ){
      def versionCode = 0
    return versionCode
  } else {
    def versionCode = value.toInteger()
    return versionCode
  }

}

def generateVersionName(){
  def envValue = System.getenv('APP_VERSION_NAME')
  if (envValue && envValue != "") {
    return envValue
  } else {
    return project.hasProperty('versionName') ? project.property('versionName') : '0.0.0'
  }
}

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.0"

    signingConfigs {
        if (System.getenv('IS_JENKINS')=="yes") {
            release {
                storeFile file(System.getenv('APP_KEYSTORE_PATH'))
                storePassword System.getenv('APP_KEYSTORE_PASS')
                keyAlias 'something'
                keyPassword System.getenv('APP_KEYSTORE_PASS')
            }
        } else {
            release {
                keyAlias 'xxx'
                keyPassword 'xxx'
                storeFile file('xxx')
                storePassword 'xxx'
            }
        }
    }

    defaultConfig {
        applicationId "com.insiderealestate.kvCore"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode generateVersionCode()
        versionName generateVersionName()
        multiDexEnabled true
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        debug {
            // Note: CodePush updates should not be tested in Debug mode as they are overriden by the RN packager. However, because CodePush checks for updates in all modes, we must supply a key.
            buildConfigField "String", "CODEPUSH_KEY", '""'
            applicationIdSuffix ".debug"
        }

        releaseStaging {
            buildConfigField "String", "CODEPUSH_KEY", '""'
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
        release {
            buildConfigField "String", "CODEPUSH_KEY", '""'
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile project(':react-native-code-push')
    compile project(':appcenter-crashes')
    compile project(':appcenter-analytics')
    compile project(':appcenter')
    compile (project(':react-native-intercom')) {
      exclude group: 'com.android.support.graphics.drawable'
    }
    compile project(':bugsnag-react-native')
    compile project(':react-native-sms')
    compile project(':react-native-linear-gradient')
    compile project(':react-native-immediate-phone-call')
    compile project(':react-native-fabric')
    compile project(':react-native-config')
    compile project(':react-native-i18n')
    compile project(':react-native-vector-icons')
    compile project(':react-native-device-info')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile 'com.android.support:appcompat-v7:28.0.0'
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
        transitive = true;
    }
    compile 'io.intercom.android:intercom-sdk-base:5.+'
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

0 个答案:

没有答案