React-native项目构建失败:找不到com.android.tools.lint,无法确定任务':app:lintVitalRelease'的依赖关系 [英] React-native project Build failed: Could not find com.android.tools.lint , Could not determine the dependencies of task ':app:lintVitalRelease'

查看:458
本文介绍了React-native项目构建失败:找不到com.android.tools.lint,无法确定任务':app:lintVitalRelease'的依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些麻烦试图生成我的应用程序的发行版。
应用可以在带有 react-native run-android 的模拟器中正常运行。
当我尝试在我的应用的android目录中运行' gradlew assembleRelease '时,我得到了这些:

I have some troubles trying to generate a release of my app. App runs normally in emulator with react-native run-android. when i try to run 'gradlew assembleRelease' in android directory of my app, i get these :


D:\REACTNATIVE\finalprj\android> gradlew assembleRelease

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

FAILURE: Build failed with an exception.

出了什么问题

无法确定任务':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:

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()
    }
}

请帮助我

任何意见和建议都会受到赞赏。

any comments and suggestions are appreciated.

推荐答案

您必须签署在尝试创建APK时释放它

您c使用 jarsigner 从命令行对应用程序捆绑包进行签名。要对APK进行签名,则必须使用 zipalign apksigner 如下:

You can use jarsigner to sign an App Bundle from the command line. To sign APK instead, you must use zipalign and apksigner as follows:


  1. Androidstudio 中,选择查看>工具窗口>终端以打开
    命令行并导航到
    未签名APK所在的目录。

  2. 使用 zipalign 对齐未签名APK:

  1. In the Androidstudio, select View > Tool Windows > Terminal to open the command line and navigate to the directory where the unsigned APK is located.
  2. Align the unsigned APK using zipalign:



zipalign -v -p 4 my-app-unsigned.apk my-app-unsigned-aligned.apk




  1. 用您的私人签名APK使用 apksigner 的密钥:

  1. Sign your APK with your private key using apksigner:



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 文件,并添加 signingConfigs {} 块,其中包含<$ c $的条目c> storeFile , storePassword keyAlias keyPassword ,然后将该对象传递给您的构建类型中的signingConfig属性。例如:

Open the module-level build.gradle file and add the signingConfigs {} block with entries for storeFile, storePassword, keyAlias and keyPassword, and then pass that object to the signingConfig property in your build type. For example:

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
            ...
        }
    }
}

这篇关于React-native项目构建失败:找不到com.android.tools.lint,无法确定任务':app:lintVitalRelease'的依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆