[英]Flutter : when i try to run flutter app that i clone from github, but the build failed, could someone inform me how to solve it?
[英]Flutter App Build Failed while flutter run
我是 Flutter 應用程序開發的新手。 交接了flutter項目並嘗試運行,但通過終端命令獲得Build Failed Exception。
flutter run -t lib/main_prod.dart
在終端中遇到這些錯誤
Using hardware rendering with device Android SDK built for x86. If you notice graphics artifacts,
consider enabling software rendering with "--enable-software-rendering".
Launching lib/main_prod.dart on Android SDK built for x86 in debug mode...
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/ashishsciit/Desktop/Ashish/onfees/edflylearnGit/android/app/build.gradle' line: 62
* What went wrong:
A problem occurred evaluating project ':app'.
> java.net.URISyntaxException: Illegal character in opaque part at index 2: C:\Work\edflylearn\edfly_learn_release_key.jks
* 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 42s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 45.0s
Exception: Gradle task assembleDebug failed with exit code 1
Android 應用級 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 plugin: 'kotlin-android'
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 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "easy.tech.innovations.edflylearn"
minSdkVersion 21
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
debug {
debuggable true
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
shrinkResources true
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.firebase:firebase-messaging:20.2.0'
}
apply plugin: 'com.google.gms.google-services'
在上面的代碼構建文件'/Users/ashishsciit/Desktop/Ashish/onfees/edflylearnGit/android/app/build.gradle' line: 62 points to
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
嘗試使用 iOS 和 Android 模擬器以及物理設備,但沒有成功我現在該怎么辦? 抱歉任何英語語法錯誤
它是 Firebase 配置的項目。
這個錯誤是因為 firebase firebase 的一些配置錯誤。 該錯誤是由於生成的密鑰庫造成的。
您應該會看到您的 firebase 控制台項目和應用程序的配置,並通過運行以下命令重新生成 SHA 指紋:
keytool -genkey -v -keystore c:\\Users\\USER_NAME\\key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key
keytool -list -v -keystore debug.keystore -alias androiddebugkey
來查看你的密鑰。第二個解決方案是
keytool -list -v -keystore debug.keystore -alias androiddebugkey
查看您的密鑰。flutter clean
pub get
再次獲取所有依賴項。您的問題很可能會得到解決。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.