Flutter如何从Android Studio中的Flutter应用程序获取发行版本

时间:2019-09-16 05:00:19

标签: android flutter

这是我的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.shabakieh.art_man"
    minSdkVersion 22
    targetSdkVersion 28
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

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

}

颤抖{     资源 '../..'    }

 dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

 }

这是另一个build.gradle

buildscript {
repositories {
    google()
    jcenter()
    maven {
        url "https://maven.google.com"
    }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.3.0'



}
}

 allprojects {
  repositories {
    jcenter()
    maven {
        url "https://maven.google.com"
    }

}
}

  rootProject.buildDir = '../build'
 subprojects {
 project.buildDir = "${rootProject.buildDir}/${project.name}"
 }
 subprojects {
 project.evaluationDependsOn(':app')
 }

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

失败:生成失败,发生异常。       * 什么地方出了错:       无法解析配置':connectivity:_internal_aapt2_binary'的所有文件。   找不到aapt2-windows.jar(com.android.tools.build:aapt2:3.3.0-5013011)。       在以下位置搜索:      https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/3.3.0-5013011/aapt2-3.3.0-        5013011-windows.jar       *尝试:       使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多信息       日志输出。用--scan运行        全面的见解。        *通过https://help.gradle.org获取更多帮助        建立失败45秒

请帮助我,我很快需要帮助。

1 个答案:

答案 0 :(得分:0)

尝试 扑打干净

关闭Android Studio

删除缓存

C:\ Users \ xxx \ .gradle \ caches

C:\ Users \ xxx \ .android \ build-cache

C:\ Users \ xxx \ .android \ cache