在Android Studio中建议将Android Gradle插件从7.0.0升级到7.0.2后,升级助手通知无法在构建文件中找到AGP版本,因此我无法进行升级。
我该怎么办?
谢谢
编译代码。格拉德尔(项目)
buildscript {
repositories {
google()
}
dependencies {
classpath Libs.androidGradlePlugin
classpath Libs.Kotlin.gradlePlugin
classpath Libs.Hilt.gradlePlugin
}
}
plugins {
id 'com.diffplug.spotless' version '5.12.4'
}
subprojects {
repositories {
google()
mavenCentral()
if (!Libs.AndroidX.Compose.snapshot.isEmpty()) {
maven { url Urls.composeSnapshotRepo }
}
if (Libs.Accompanist.version.endsWith('SNAPSHOT')) {
maven { url Urls.mavenCentralSnapshotRepo }
}
}
apply plugin: 'com.diffplug.spotless'
spotless {
kotlin {
target '**/*.kt'
targetExclude("$buildDir/**/*.kt")
targetExclude('bin/**/*.kt')
ktlint(Versions.ktLint)
licenseHeaderFile rootProject.file('spotless/copyright.kt')
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "1.8"
// Use experimental APIs
freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
}
}
// androidx.test and hilt are forcing JUnit, 4.12. This forces them to use 4.13
configurations.configureEach {
resolutionStrategy {
force Libs.JUnit.junit
}
}
}
编译代码。格雷德尔(模块)
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
}
// Reads the Google maps key that is used in the AndroidManifest
Properties properties = new Properties()
if (rootProject.file("local.properties").exists()) {
properties.load(rootProject.file("local.properties").newDataInputStream())
}
android {
compileSdkVersion 31
defaultConfig {
applicationId "androidx.compose.samples.crane"
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.compose.samples.crane.CustomTestRunner"
manifestPlaceholders = [ googleMapsKey : properties.getProperty("google.maps.key", "") ]
}
signingConfigs {
// We use a bundled debug keystore, to allow debug builds from CI to be upgradable
// Cert fingerprint =
debug {
storeFile rootProject.file('debug.keystore')
storePassword 'xxxxxxxxxx'
keyAlias 'xxxxxxxxxxx'
keyPassword 'xxxxxxxxxx'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
compose true
// Disable unused AGP features
buildConfig false
aidl false
renderScript false
resValues false
shaders false
}
composeOptions {
kotlinCompilerExtensionVersion Libs.AndroidX.Compose.version
}
packagingOptions {
// Multiple dependency bring these files in. Exclude them to enable
// our test APK to build (has no effect on our AARs)
excludes += "/META-INF/AL2.0"
excludes += "/META-INF/LGPL2.1"
}
}
dependencies {
implementation Libs.Kotlin.stdlib
implementation Libs.Kotlin.Coroutines.android
implementation Libs.GoogleMaps.maps
implementation Libs.GoogleMaps.mapsKtx
constraints {
// Volley is a transitive dependency of maps
implementation(Libs.Volley.volley) {
because("Only volley 1.2.0 or newer are available on maven.google.com")
}
}
implementation Libs.Accompanist.insets
implementation Libs.AndroidX.Activity.activityCompose
implementation Libs.AndroidX.appcompat
implementation Libs.AndroidX.Compose.runtime
implementation Libs.AndroidX.Compose.foundation
implementation Libs.AndroidX.Compose.material
implementation Libs.AndroidX.Compose.layout
implementation Libs.AndroidX.Compose.animation
implementation Libs.AndroidX.Compose.tooling
implementation Libs.AndroidX.Lifecycle.viewModelCompose
implementation Libs.AndroidX.Lifecycle.viewModelKtx
implementation Libs.Coil.compose
implementation Libs.Hilt.android
kapt Libs.Hilt.compiler
androidTestImplementation Libs.JUnit.junit
androidTestImplementation Libs.AndroidX.Test.runner
androidTestImplementation Libs.AndroidX.Test.espressoCore
androidTestImplementation Libs.AndroidX.Test.rules
androidTestImplementation Libs.AndroidX.Test.Ext.junit
androidTestImplementation Libs.Kotlin.Coroutines.test
androidTestImplementation Libs.AndroidX.Compose.uiTest
androidTestImplementation Libs.Hilt.android
androidTestImplementation Libs.Hilt.testing
kaptAndroidTest Libs.Hilt.compiler
}
代码在build.gradle.kts
repositories {
jcenter()
}
plugins {
`kotlin-dsl`
}
在我的情况下,以下步骤解决了这个问题:
cd to project directory
bash ./gradlew help --scan
bash ./gradlew wrapper --gradle-version 7.0.2
请参阅gradle发行说明中7.0.2版的升级说明。
我不知道这对你的问题很关键,但是修改一下这个
repositories {
jcenter()
}
到
repositories {
mavenCentral()
}
应该是需要的。因为jcenter()
已经过时了。
有人能告诉我哪里出了问题吗?
为了学习JavaFX,我使用IntelliJ IDEA创建了我的第一个项目,并将该项目导出为Eclipse项目。当我在这两个IDE中运行项目时,一切都运行得很好。不幸的是,在构建项目并尝试运行.jar或.exe文件之后,我得到了一个异常,我认为问题出在FXMLLoader中,它无法找到fxml文件。 项目层次结构
昨天晚上我把Xcode SDK升级到第10版,然后发现我无法构建。 我得到了这个错误: 找不到生成输入文件:'/users/call01/library/developer/xcode/deriveddata/comp-lite-apps-gytvmossqptokeafrddvvmnlzadk/Build/products/debug-iphoneos/sg11.app/sg11 这在我升级之前
我得到了这两个错误。错误:找不到或加载主类骰子生成项目错误:找不到符号 我的文件保存为Dice.java.我检查了,因为这是我最后一个程序的问题之一。至于符号错误,我不确定。 公共类骰子{ //掷骰子。 扫描仪键盘=新扫描仪(System.in); 这只是源代码的一部分。
我需要使用PITest进行突变测试,但我很难尝试通过Maven安装它,当我尝试运行PIT以执行突变和测试用例时,我在cmd中收到此错误: “在当前项目和插件组中未找到前缀“org.pitest”的插件” 有人能帮我解决这个问题吗? 我的代码: 我的测试: pom.xml: 这是出现在my cmd上的错误:
我下载并反编译了minecraft插件的jar文件,并通过创建一个新的java项目Import将其添加到eclipse中 这导致了: 之后,我更改了一行代码,然后尝试导出它。 我不知道我该怎么做来解决这个问题。请帮忙。