我要为Android设备构建ExpoKit项目时出错

时间:2019-08-30 14:40:57

标签: android react-native build android-ndk expo

我想为我的项目构建一个构建和一个APK文件(iOS方面一切正常)。因此,我使用ExpoKit和React native,并且在Android Studio上运行构建时

第一个错误与Android NDK有关,我安装了它并将其链接到应用程序,但该错误不会消失。第二个是关于getExternalNativeBuildTasks的,因为它已经过时了。

以下是错误:

  

信息:以下项目选项已被弃用并被删除:   android.useDeprecatedNdk   不再支持NdkCompile   受影响的模块:...所有模块

     

信息:API'variant.getExternalNativeBuildTasks()'已过时,并已替换为'variant.getExternalNativeBuildProviders()'。   它将在2019年底删除。   有关更多信息,请参见https://d.android.com/r/tools/task-configuration-avoidance。   要确定正在调用variant.getExternalNativeBuildTasks()的内容,请在命令行上使用-Pandroid.debug.obsoleteApi = true来显示更多信息。   受影响的模块:应用

     

失败:构建失败,并出现异常。

  • 出了什么问题:
      

    任务':app:checkDebugManifest'的执行失败。   创建目录'/ Applications / MAMP / htdocs / teaser-beta / android / app / build / intermediates / check_manifest_result / debug /时,无法创建父目录'/ Applications / MAMP / htdocs / teaser-beta / android / app / build' checkDebugManifest / out'

39秒内失败

这是我的应用程序build.gradle

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

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

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

def safeExtGet(prop, fallback) {
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

android {
  compileSdkVersion safeExtGet("compileSdkVersion", 28)

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }

  defaultConfig {
    applicationId 'com.teaser.teaserapp'
    minSdkVersion safeExtGet("minSdkVersion", 21)
    targetSdkVersion safeExtGet("targetSdkVersion", 28)
    versionCode 1
    versionName '1.0.0'
    ndk {
      abiFilters 'armeabi-v7a', 'x86'
    }
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    // Deprecated. Used by net.openid:appauth
    manifestPlaceholders = [
        'appAuthRedirectScheme': 'exp2380b083a58f44f18b907895680c3863'
    ]
  }
  dexOptions {
    javaMaxHeapSize System.getenv("DISABLE_DEX_MAX_HEAP") ? null : "8g"
  }

  signingConfigs {
    debug {
      storeFile file('../debug.keystore')
    }
    release {
      storeFile file(System.getenv("ANDROID_KEYSTORE_PATH") ?: "release-key.jks")
      storePassword System.getenv("ANDROID_KEYSTORE_PASSWORD")
      keyAlias System.getenv("ANDROID_KEY_ALIAS")
      keyPassword System.getenv("ANDROID_KEY_PASSWORD")
    }
  }
  buildTypes {
    debug {
      debuggable true
      ext.enableCrashlytics = false
    }
    release {
      minifyEnabled true
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      signingConfig signingConfigs.release
    }
  }
  lintOptions {
    abortOnError false
  }
  packagingOptions {
    pickFirst "**"
  }
}

devicefarm {
  projectName System.getenv("DEVICEFARM_PROJECT_NAME")
  devicePool System.getenv("DEVICEFARM_DEVICE_POOL")
  executionTimeoutMinutes 40
  authentication {

    accessKey System.getenv("AWS_ACCESS_KEY_ID")
    secretKey System.getenv("AWS_SECRET_ACCESS_KEY")
  }
}

configurations.all {
  resolutionStrategy {
    force 'org.webkit:android-jsc:r241213'
  }
}

// WHEN_PREPARING_SHELL_REMOVE_FROM_HERE

apply from: 'expo.gradle'

// WHEN_PREPARING_SHELL_REMOVE_TO_HERE

apply from: "../../node_modules/react-native-unimodules/gradle.groovy"

dependencies {
  // All dependencies (i have delete the implementation)

  api 'org.webkit:android-jsc:r241213' // needs to be before react-native
  api 'com.facebook.react:react-native:33.0.0'




  addUnimodulesDependencies([
      modulesPaths : [
        '../../node_modules'
      ],
      configuration: 'api',
      target       : 'react-native',
      exclude      : [
        // You can exclude unneeded modules here.
        // By default we exclude FaceDetector
        // and Stripe payments APIs.
        'unimodules-face-detector-interface',
        'expo-face-detector',
        'expo-payments-stripe',
        'expo-app-auth',
        // Adding a name here will also remove the package
        // from auto-generated BasePackageList.java
      ]
  ])

}
// This has to be down here for some reason
apply plugin: 'com.google.gms.google-services'

还有我的build.gradle

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

buildscript {
  ext {
    minSdkVersion = 21
    targetSdkVersion = 28
    compileSdkVersion = 28
    buildToolsVersion = '28.0.0'
    supportLibVersion = '28.0.0'
    kotlinVersion = '1.3.21'
    repositoryUrl = "file:${System.env.HOME}/.m2/repository/"
  }
  repositories {
    google()
    jcenter()
    maven { url 'https://dl.bintray.com/android/android-tools/' }
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.5.0'
    classpath 'com.google.gms:google-services:3.2.1'
    classpath 'de.undercouch:gradle-download-task:2.0.0'

    // https://github.com/awslabs/aws-device-farm-gradle-plugin/releases
    classpath 'com.amazonaws:aws-devicefarm-gradle-plugin:1.3'

    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
  }
}

allprojects {
  repositories {
    // For non-detach
    maven {
      url "$rootDir/maven"
    }
    // For old expoviews to work
    maven {
      url "$rootDir/versioned-abis/expoview-abi31_0_0/maven"
    }
    maven {
      url "$rootDir/versioned-abis/expoview-abi32_0_0/maven"
    }
    maven {
      url "$rootDir/versioned-abis/expoview-abi33_0_0/maven"
    }
    maven {
      url "$rootDir/versioned-abis/maven"
    }
    // For detach
    maven {
      url "$rootDir/../node_modules/expokit/maven"
    }
    maven {
      // We use a modified build of com.android.support.test:runner:1.0.1. Explanation in maven-test/README
      url "$rootDir/maven-test"
    }
    google()
    jcenter()
    maven {
      // Local Maven repo containing AARs with JSC built for Android
      url "$rootDir/../node_modules/jsc-android/dist"
    }
    flatDir {
      dirs 'libs'
      // dirs project(':expoview').file('libs')
    }
    // https://github.com/google/ExoPlayer/issues/5225#issuecomment-445739013
    maven { url 'https://google.bintray.com/exoplayer' }
    maven { url "https://jitpack.io" }

    // Want this last so that we never end up with a stale cache
    mavenLocal()
  }
}

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

所以我无法在没有Android Studio的情况下构建项目或尝试运行。 也许我失败了或者我更新了SDK?

谢谢

0 个答案:

没有答案