我正在尝试运行我在设备上编写的flutter应用程序,但当我尝试运行时,我从未通过“assembleDebug”阶段并在终端中获得此消息:
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':smart_auth'.
> Could not resolve all files for configuration ':smart_auth:classpath'.
> Could not download gradle-4.1.3.jar (com.android.tools.build:gradle:4.1.3)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.3/gradle-4.1.3.jar'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.3/gradle-4.1.3.jar'.
> Connect to dl.google.com:443 [dl.google.com/172.217.170.174] failed: Connection timed out: connect
/* Many similar could not GET links */
> Could not get unknown property 'android' for project ':smart_auth' of type org.gradle.api.Project.
> Could not get unknown property 'android' for project ':smart_auth' of type org.gradle.api.Project.
* 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.
我最近添加了pinput包,并将smart_auth作为其依赖项之一,导致了错误。我的flutter医生没有问题。Flutter版本是3.7.7,dart版本是2.19.4。android\build.gradle
:
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android\app\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 flutter.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "com.example"
minSdkVersion 18
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
android\gradle\wrapper\gradle-wrapper.properties
:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
android\gradle.properties
:
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
pubspec.yaml
:
version: 1.0.0+1
environment:
sdk: '>=2.18.6 <3.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
get: ^4.6.1
google_fonts: ^4.0.3
flutter_screenutil: ^5.1.1
flutter_dotenv: ^5.0.2
get_storage: ^2.0.3
persistent_bottom_nav_bar: ^5.0.2
jiffy: ^6.1.0
permission_handler: ^10.2.0
mockito: ^5.1.0
loader_overlay: ^2.0.6
intl: ^0.18.0
fluttertoast: ^8.2.1
material_design_icons_flutter: ^6.0.7096
url_launcher: ^6.1.10
freezed_annotation: ^2.2.0
json_annotation: ^4.8.0
flutter_secure_storage: 7.0.1
http: ^0.13.5
flutter_svg: ^2.0.4
cached_network_image: ^3.2.3
internet_connection_checker: ^1.0.0+1
simple_animations: ^5.0.0+3
pinput: ^2.2.31
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
build_runner: ^2.1.10
freezed: ^2.3.2
json_serializable: ^6.6.1
flutter_launcher_icons: ^0.12.0
1条答案
按热度按时间owfi6suc1#
我也有同样的问题无法找到smart_auth.尝试了几种解决方案,但无法解决它.你得到的错误,如果你是在模拟器上运行的代码.它不显示在真实的设备上的错误.似乎是一个错误.