网站改版 被k,seo需要付费吗,河南郑州最新新闻,成都网站建设成功案例单招网文章目录 错误描述解决方法修正方案#xff1a;继续使用 apply from修正后的 build.gradle说明警告的处理进一步验证 错误描述
Plugin [id: ‘flutter’] was not found in any of the following sources:
Gradle Core Plugins (not a core plugin, please see https://docs… 文章目录 错误描述解决方法修正方案继续使用 apply from修正后的 build.gradle说明警告的处理进一步验证 错误描述
Plugin [id: ‘flutter’] was not found in any of the following sources:
Gradle Core Plugins (not a core plugin, please see https://docs.gradle.org/7.5/userguide/standard_plugins.html for available core plugins)Plugin Repositories (plugin dependency must include a version number for this source)
解决方法
报错提示 Gradle 无法找到 flutter 插件因为它不是 Gradle 的核心插件且没有指定插件的来源和版本。Flutter 插件是通过 apply from 方式引入的而不是通过 Gradle Plugin Portal 或类似的插件仓库。
要修正这个问题需要调整配置正确引入 Flutter 的 Gradle 插件。 修正方案继续使用 apply from
由于 Flutter 的 Gradle 插件是 Flutter SDK 自带的目前还不能直接通过 plugins 块引入。因此仍需保留以下语句
apply from: $flutterRoot/packages/flutter_tools/gradle/flutter.gradle完整的 build.gradle 文件应该保持如下结构 修正后的 build.gradle
apply plugin: com.android.application
apply plugin: kotlin-android
apply from: $flutterRoot/packages/flutter_tools/gradle/flutter.gradledef 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
}android {compileSdkVersion flutter.compileSdkVersionndkVersion flutter.ndkVersioncompileOptions {sourceCompatibility JavaVersion.VERSION_1_8targetCompatibility JavaVersion.VERSION_1_8}kotlinOptions {jvmTarget 1.8}sourceSets {main.java.srcDirs src/main/kotlin}defaultConfig {applicationId com.example.learningminSdkVersion 21targetSdkVersion flutter.targetSdkVersionversionCode flutterVersionCode.toInteger()versionName flutterVersionName}buildTypes {release {signingConfig signingConfigs.debug}}
}flutter {source ../..
}dependencies {implementation org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_versionimplementation com.android.support:multidex:1.0.3
}说明
apply from: $flutterRoot/packages/flutter_tools/gradle/flutter.gradle 是 Flutter 官方推荐的加载方式。当前 Flutter SDK 尚未将插件迁移到 Gradle Plugin Portal因此无法通过 plugins 块直接声明。 警告的处理
虽然警告仍然存在但这是 Flutter 官方插件机制的限制。在未来的 Flutter 版本中官方可能会发布新的机制来消除这种警告。 进一步验证
清理项目flutter clean重新生成 APKflutter build apk结束语 Flutter是一个由Google开发的开源UI工具包它可以让您在不同平台上创建高质量、美观的应用程序而无需编写大量平台特定的代码。我将学习和深入研究Flutter的方方面面。从基础知识到高级技巧从UI设计到性能优化欢饮关注一起讨论学习共同进入Flutter的精彩世界