Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gradle 当build在android studio中发布带有颤振的APK时出错_Gradle_Flutter - Fatal编程技术网

Gradle 当build在android studio中发布带有颤振的APK时出错

Gradle 当build在android studio中发布带有颤振的APK时出错,gradle,flutter,Gradle,Flutter,我可以毫无问题地构建一个调试apk,并且我在三台移动设备上尝试我的应用程序时没有任何错误,但当我尝试构建发布的apk时,我遇到了以下错误: D:\mis>flutter build apk Initializing gradle... 1.0s Resolving dependencies... 4.5s Gradle task

我可以毫无问题地构建一个调试apk,并且我在三台移动设备上尝试我的应用程序时没有任何错误,但当我尝试构建发布的apk时,我遇到了以下错误:

D:\mis>flutter build apk
Initializing gradle...                                           1.0s
Resolving dependencies...                                        4.5s
Gradle task 'assembleRelease'...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugAndroidTestRuntimeClasspath'.
   > Could not resolve com.android.support:support-annotations:25.3.1.
     Required by:
         project :app
      > Cannot find a version of 'com.android.support:support-annotations' that satisfies the version constraints:
           Dependency path 'android:app:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
           Dependency path 'android:app:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support.test:monitor:1.0.2' --> 'com.android.support:support-annota
tions:27.1.1'
           Dependency path 'android:app:unspecified' --> 'com.android.support.test.espresso:espresso-core:3.0.2' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support
:support-annotations:27.1.1'
           Dependency path 'android:app:unspecified' --> 'com.alveliu.flutterfullpdfviewer:flutter_full_pdf_viewer:1.0.0' --> 'com.github.barteksc:android-pdf-viewer:2.8.2' --> 'com
.github.barteksc:pdfium-android:1.7.1' --> 'com.android.support:support-v4:25.3.1' --> 'com.android.support:support-compat:25.3.1' --> 'com.android.support:support-annotations:25.3.
1'
           Dependency path 'android:app:unspecified' --> 'com.alveliu.flutterfullpdfviewer:flutter_full_pdf_viewer:1.0.0' --> 'com.github.barteksc:android-pdf-viewer:2.8.2' --> 'com
.github.barteksc:pdfium-android:1.7.1' --> 'com.android.support:support-v4:25.3.1' --> 'com.android.support:support-media-compat:25.3.1' --> 'com.android.support:support-annotations
:25.3.1'
           Dependency path 'android:app:unspecified' --> 'com.alveliu.flutterfullpdfviewer:flutter_full_pdf_viewer:1.0.0' --> 'com.github.barteksc:android-pdf-viewer:2.8.2' --> 'com
.github.barteksc:pdfium-android:1.7.1' --> 'com.android.support:support-v4:25.3.1' --> 'com.android.support:support-core-utils:25.3.1' --> 'com.android.support:support-annotations:2
5.3.1'
           Dependency path 'android:app:unspecified' --> 'com.alveliu.flutterfullpdfviewer:flutter_full_pdf_viewer:1.0.0' --> 'com.github.barteksc:android-pdf-viewer:2.8.2' --> 'com
.github.barteksc:pdfium-android:1.7.1' --> 'com.android.support:support-v4:25.3.1' --> 'com.android.support:support-core-ui:25.3.1' --> 'com.android.support:support-annotations:25.3
.1'
           Constraint path 'android:app:unspecified' --> 'com.android.support:support-annotations' strictly '25.3.1' because of the following reason: debugRuntimeClasspath uses vers
ion 25.3.1
           Constraint path 'android:app:unspecified' --> 'com.android.support:support-annotations' strictly '25.3.1' because of the following reason: debugRuntimeClasspath uses vers
ion 25.3.1
           Constraint path 'android:app:unspecified' --> 'com.android.support:support-annotations' strictly '25.3.1' because of the following reason: debugRuntimeClasspath uses vers
ion 25.3.1
           Constraint path 'android:app:unspecified' --> 'com.android.support:support-annotations' strictly '25.3.1' because of the following reason: debugRuntimeClasspath uses vers
ion 25.3.1

   > Could not resolve com.android.support:support-annotations:27.1.1.
     Required by:
         project :app > com.android.support.test:runner:1.0.2
         project :app > com.android.support.test:runner:1.0.2 > com.android.support.test:monitor:1.0.2
      > Cannot find a version of 'com.android.support:support-annotations' that satisfies the version constraints:
           Dependency path 'android:app:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
           Dependency path 'android:app:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support.test:monitor:1.0.2' --> 'com.android.support:support-annota
tions:27.1.1'
           Dependency path 'android:app:unspecified' --> 'com.android.support.test.espresso:espresso-core:3.0.2' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support
:support-annotations:27.1.1'
           Dependency path 'android:app:unspecified' --> 'com.alveliu.flutterfullpdfviewer:flutter_full_pdf_viewer:1.0.0' --> 'com.github.barteksc:android-pdf-viewer:2.8.2' --> 'com
.github.barteksc:pdfium-android:1.7.1' --> 'com.android.support:support-v4:25.3.1' --> 'com.android.support:support-compat:25.3.1' --> 'com.android.support:support-annotations:25.3.
1'
           Dependency path 'android:app:unspecified' --> 'com.alveliu.flutterfullpdfviewer:flutter_full_pdf_viewer:1.0.0' --> 'com.github.barteksc:android-pdf-viewer:2.8.2' --> 'com
.github.barteksc:pdfium-android:1.7.1' --> 'com.android.support:support-v4:25.3.1' --> 'com.android.support:support-media-compat:25.3.1' --> 'com.android.support:support-annotations
:25.3.1'
           Dependency path 'android:app:unspecified' --> 'com.alveliu.flutterfullpdfviewer:flutter_full_pdf_viewer:1.0.0' --> 'com.github.barteksc:android-pdf-viewer:2.8.2' --> 'com
.github.barteksc:pdfium-android:1.7.1' --> 'com.android.support:support-v4:25.3.1' --> 'com.android.support:support-core-utils:25.3.1' --> 'com.android.support:support-annotations:2
5.3.1'
           Dependency path 'android:app:unspecified' --> 'com.alveliu.flutterfullpdfviewer:flutter_full_pdf_viewer:1.0.0' --> 'com.github.barteksc:android-pdf-viewer:2.8.2' --> 'com
.github.barteksc:pdfium-android:1.7.1' --> 'com.android.support:support-v4:25.3.1' --> 'com.android.support:support-core-ui:25.3.1' --> 'com.android.support:support-annotations:25.3
.1'
           Constraint path 'android:app:unspecified' --> 'com.android.support:support-annotations' strictly '25.3.1' because of the following reason: debugRuntimeClasspath uses vers
ion 25.3.1
           Constraint path 'android:app:unspecified' --> 'com.android.support:support-annotations' strictly '25.3.1' because of the following reason: debugRuntimeClasspath uses vers
ion 25.3.1
           Constraint path 'android:app:unspecified' --> 'com.android.support:support-annotations' strictly '25.3.1' because of the following reason: debugRuntimeClasspath uses vers
ion 25.3.1
           Constraint path 'android:app:unspecified' --> 'com.android.support:support-annotations' strictly '25.3.1' because of the following reason: debugRuntimeClasspath uses vers
ion 25.3.1

   > Could not resolve com.android.support:support-annotations:25.3.1.
     Required by:
         project :app > com.android.support:support-compat:25.3.1
         project :app > com.android.support:support-media-compat:25.3.1
         project :app > com.android.support:support-core-utils:25.3.1
         project :app > com.android.support:support-core-ui:25.3.1
      > Cannot find a version of 'com.android.support:support-annotations' that satisfies the version constraints:
           Dependency path 'android:app:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
           Dependency path 'android:app:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support.test:monitor:1.0.2' --> 'com.android.support:support-annota
tions:27.1.1'
           Dependency path 'android:app:unspecified' --> 'com.android.support.test.espresso:espresso-core:3.0.2' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support
:support-annotations:27.1.1'
           Dependency path 'android:app:unspecified' --> 'com.alveliu.flutterfullpdfviewer:flutter_full_pdf_viewer:1.0.0' --> 'com.github.barteksc:android-pdf-viewer:2.8.2' --> 'com
.github.barteksc:pdfium-android:1.7.1' --> 'com.android.support:support-v4:25.3.1' --> 'com.android.support:support-compat:25.3.1' --> 'com.android.support:support-annotations:25.3.
1'
           Dependency path 'android:app:unspecified' --> 'com.alveliu.flutterfullpdfviewer:flutter_full_pdf_viewer:1.0.0' --> 'com.github.barteksc:android-pdf-viewer:2.8.2' --> 'com
.github.barteksc:pdfium-android:1.7.1' --> 'com.android.support:support-v4:25.3.1' --> 'com.android.support:support-media-compat:25.3.1' --> 'com.android.support:support-annotations
:25.3.1'
           Dependency path 'android:app:unspecified' --> 'com.alveliu.flutterfullpdfviewer:flutter_full_pdf_viewer:1.0.0' --> 'com.github.barteksc:android-pdf-viewer:2.8.2' --> 'com
.github.barteksc:pdfium-android:1.7.1' --> 'com.android.support:support-v4:25.3.1' --> 'com.android.support:support-core-utils:25.3.1' --> 'com.android.support:support-annotations:2
5.3.1'
           Dependency path 'android:app:unspecified' --> 'com.alveliu.flutterfullpdfviewer:flutter_full_pdf_viewer:1.0.0' --> 'com.github.barteksc:android-pdf-viewer:2.8.2' --> 'com
.github.barteksc:pdfium-android:1.7.1' --> 'com.android.support:support-v4:25.3.1' --> 'com.android.support:support-core-ui:25.3.1' --> 'com.android.support:support-annotations:25.3
.1'
           Constraint path 'android:app:unspecified' --> 'com.android.support:support-annotations' strictly '25.3.1' because of the following reason: debugRuntimeClasspath uses vers
ion 25.3.1
           Constraint path 'android:app:unspecified' --> 'com.android.support:support-annotations' strictly '25.3.1' because of the following reason: debugRuntimeClasspath uses vers
ion 25.3.1
           Constraint path 'android:app:unspecified' --> 'com.android.support:support-annotations' strictly '25.3.1' because of the following reason: debugRuntimeClasspath uses vers
ion 25.3.1
           Constraint path 'android:app:unspecified' --> 'com.android.support:support-annotations' strictly '25.3.1' because of the following reason: debugRuntimeClasspath uses vers
ion 25.3.1


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 5s
 6.4s
Gradle task assembleRelease failed with exit code 1
我下载了一个新的Gradle,但还是一样的问题

这是我的build.gradle文件:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}


android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.mis"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

   signingConfigs {
    release {
        keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties['keyPassword']
        storeFile file(keystoreProperties['storeFile'])
        storePassword keystoreProperties['storePassword']
    }
}
buildTypes {
    release {
        signingConfig signingConfigs.release
        minifyEnabled true
            useProguard true

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
我不知道这个问题出在哪里?我们该如何解决这个问题呢?是从格拉德来的吗?还是什么?

添加

lintOptions {
        disable 'InvalidPackage'
        checkReleaseBuilds false
}
在android/app/build.gradle中添加

lintOptions {
        disable 'InvalidPackage'
        checkReleaseBuilds false
}

在android/app/build.gradle中

它需要在android部分的内部,而不是根目录下。你应该在回复IMHO中提到这一点。它需要在android内部部分下,而不是在根目录下。你应该在IMHO的回复中提到这一点。