【问题标题】:React-native project Build failed: Could not find com.android.tools.lint , Could not determine the dependencies of task ':app:lintVitalRelease'React-native项目构建失败:找不到com.android.tools.lint,无法确定任务':app:lintVitalRelease'的依赖关系
【发布时间】:2019-08-17 20:28:55
【问题描述】:

我在尝试生成我的应用程序版本时遇到了一些麻烦。 应用程序在 react-native run-android 的模拟器中正常运行。 当我尝试在我的应用程序的 android 目录中运行“gradlew assembleRelease”时,我得到了这些:

D:\REACTNATIVE\finalprj\android>gradlew assembleRelease

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

出了什么问题

无法确定任务':app:lintVitalRelease'的依赖关系。

无法解决配置“:app:lintClassPath”的所有任务依赖关系。

找不到 com.android.tools.lint:lint-gradle:26.4.2。

 Searched in the following locations:
   - file:/C:/Users/Sam/.m2/repository/com/android/tools/lint/lint-gradle/26.4.2/lint-gradle-26.4.2.pom
   - file:/C:/Users/Sam/.m2/repository/com/android/tools/lint/lint-gradle/26.4.2/lint-gradle-26.4.2.jar
   - https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle/26.4.2/lint-gradle-26.4.2.pom
   - https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle/26.4.2/lint-gradle-26.4.2.jar
   - file:/D:/REACTNATIVE/finalprj/node_modules/react-native/android/com/android/tools/lint/lint-gradle/26.4.2/lint-gradle-26.4.2.pom
   - file:/D:/REACTNATIVE/finalprj/node_modules/react-native/android/com/android/tools/lint/lint-gradle/26.4.2/lint-gradle-26.4.2.jar
   - file:/D:/REACTNATIVE/finalprj/node_modules/jsc-android/dist/com/android/tools/lint/lint-gradle/26.4.2/lint-gradle-26.4.2.pom
   - file:/D:/REACTNATIVE/finalprj/node_modules/jsc-android/dist/com/android/tools/lint/lint-gradle/26.4.2/lint-gradle-26.4.2.jar
   - https://jcenter.bintray.com/com/android/tools/lint/lint-gradle/26.4.2/lint-gradle-26.4.2.pom
   - https://jcenter.bintray.com/com/android/tools/lint/lint-gradle/26.4.2/lint-gradle-26.4.2.jar
 Required by:
     project :app

build.gradle:

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

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath('com.android.tools.build:gradle:3.4.2')
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

        jcenter()
        google()
    }
}

请帮帮我

感谢任何 cmets 和建议。

【问题讨论】:

    标签: android react-native build.gradle


    【解决方案1】:

    将此添加到 android {....} 内的 build.gradle 中。

    android{
    ....
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    }
    

    【讨论】:

      【解决方案2】:

      您必须在尝试创建 release APK 时对其进行签名。

      您可以使用 jarsigner 从命令行签署 App Bundle。要改为签署 APK,您必须使用 zipalignapksigner,如下所示:

      1. Androidstudio中,选择查看>工具窗口>终端 打开命令行并导航到所在目录 找到未签名的 APK。
      2. 使用zipalign对齐未签名的APK:
      zipalign -v -p 4 my-app-unsigned.apk my-app-unsigned-aligned.apk
      
      1. 使用您的私钥使用 apksigner 为您的 APK 签名:
      apksigner sign --ks my-release-key.jks --out my-app-release.apk my-app-unsigned-aligned.apk
      
      1. 验证您的 APK 是否已签名:
      apksigner verify my-app-release.apk
      

      配置 Gradle 以签署您的应用

      打开模块级 build.gradle 文件并添加带有 storeFilestorePasswordkeyAliaskeyPassword 条目的 signingConfigs {} 块,然后将该对象传递给构建中的 signingConfig 属性类型。例如:

      android {
          ...
          defaultConfig { ... }
          signingConfigs {
              release {
                  // You need to specify either an absolute path or include the
                  // keystore file in the same directory as the build.gradle file.
                  storeFile file("my-release-key.jks")
                  storePassword "password"
                  keyAlias "my-alias"
                  keyPassword "password"
              }
          }
          buildTypes {
              release {
                  signingConfig signingConfigs.release
                  ...
              }
          }
      }
      

      【讨论】:

      • 非常感谢。 \ (•◡•) /
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-07-03
      • 2021-04-01
      • 1970-01-01
      • 2019-11-21
      • 2020-01-12
      • 2020-07-08
      • 2020-07-11
      相关资源
      最近更新 更多