gpt4 book ai didi

android - Flutter应用程式正在Android模拟器上执行,但未在实体装置(OnePlus 7T)上执行

转载 作者:行者123 更新时间:2023-12-03 05:26:34 31 4
gpt4 key购买 nike

当我在Android模拟器上运行flutter应用程序时,该应用程序运行没有错误,但是当我在移动设备上运行该应用程序时,它在调试控制台中显示了以下错误:

在HD1901上以 Debug模式启动lib \ main.dart ...
失败:生成失败,发生异常。

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
> Failed to transform artifact 'arm64_v8a_debug.jar (io.flutter:arm64_v8a_debug:1.0.0-af51afceb8886cc11e25047523c4e0c7e1f5d408)' to match attributes {artifactType=android-classes, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.

> Execution failed for JetifyTransform: C:\Users\Bharat\.gradle\caches\modules-2\files-2.1\io.flutter\arm64_v8a_debug\1.0.0-af51afceb8886cc11e25047523c4e0c7e1f5d408\b829535c84919575c5e7bfe4ebb08763a01eceec\arm64_v8a_debug-1.0.0-af51afceb8886cc11e25047523c4e0c7e1f5d408.jar.

> Failed to transform 'C:\Users\Bharat\.gradle\caches\modules-2\files-2.1\io.flutter\arm64_v8a_debug\1.0.0-af51afceb8886cc11e25047523c4e0c7e1f5d408\b829535c84919575c5e7bfe4ebb08763a01eceec\arm64_v8a_debug-1.0.0-af51afceb8886cc11e25047523c4e0c7e1f5d408.jar' using Jetifier. Reason: invalid entry size (expected 27494264 but got 27496386 bytes). (Run with --stacktrace for more details.)

* 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 48s
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

连接了设备的“flutter doctor -v”的输出:
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.18363.720], locale en-IN)
• Flutter version 1.12.13+hotfix.9 at C:\src\flutter
• Framework revision f139b11009 (4 days ago), 2020-03-30 13:57:30 -0700
• Engine revision af51afceb8
• Dart version 2.7.2


[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\Bharat\AppData\Local\Android\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• ANDROID_HOME = C:\Users\Bharat\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.

[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 43.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] VS Code (version 1.43.2)
• VS Code at C:\Users\Bharat\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.8.1

[√] Connected device (1 available)
• HD1901 • 90801aca • android-arm64 • Android 10 (API 29)

• No issues found!

应用程序级别“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"

android {
compileSdkVersion 28

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

lintOptions {
disable 'InvalidPackage'
}

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

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}

flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

项目级别的“build.gradle”文件的内容:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
jcenter()
}
}

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

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

还包括“gradle-wrapper.properties”文件的内容:
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

最佳答案

解决后,只需删除C:\ Users \ .gradle \中“.gradle”文件夹中的所有内容
如果显示文件已打开且无法删除,则只需打开任务管理器,转到“详细信息”选项卡并找到“java.exe”
右键单击每个“java.exe”,然后单击“结束进程树”。所有java.exe进程结束后,返回“.gradle”文件夹并删除所有内容。
而已。 :)

关于android - Flutter应用程式正在Android模拟器上执行,但未在实体装置(OnePlus 7T)上执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61012389/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com