如何运行xml自动建议



在Android Studio中,当您键入例如<文本框你以为自动建议不会给我";match_parent";或";wrap_ content";宽度和高度属性的选择喜欢这张照片:图像1

对于ID属性,我没有得到任何建议,只能完整地写出来添加它喜欢这张照片:图像2

注意:我不认为安卓工作室的问题因为在另一个项目中,它运行得很好喜欢这张照片:图像3并且这个:图像4

不同的是,我在摇篮里就改变了,我真的不知道我做错了什么。我试图比较这两个项目之间的差异,但没有任何帮助

这是Gradle的新设置:有人能帮忙吗。。。

Gradle(项目级(

// Top-level build file where you can add configuration options 
common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.7.10'
ext.hilt_version = '2.43.2'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle- 
plugin:$kotlin_version"
classpath "com.google.dagger:hilt-android-gradle- 
plugin:$hilt_version"
classpath 'com.google.gms:google-services:4.3.13'

// NOTE: Do not place your application dependencies here; 
they belong
// in the individual module build.gradle files
}

}
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
// Sdk and tools
// Support library and architecture components support minSdk 
14 and above.
minSdkVersion = 21
targetSdkVersion = 30
compileSdkVersion = 33
// App dependencies
}

Gradle(模块级(:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: "dagger.hilt.android.plugin"
apply plugin: 'com.google.gms.google-services'
android {
compileSdk rootProject.compileSdkVersion
defaultConfig {
applicationId "com.mostafan3ma.android.menupro10"
minSdk rootProject.minSdkVersion
targetSdk rootProject.targetSdkVersion
versionCode 1
versionName "1.0"

testInstrumentationRunner "com.mostafan3ma.android.hilttesting.MyHiltTestRunner"
}
buildTypes {
release {
minifyEnabled false
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 {
viewBinding true
dataBinding true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.firebase:firebase-firestore-ktx:24.3.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
def hilt_version = "2.43.2"
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
def hilt_view_models = "1.0.0-alpha03"
kapt "androidx.hilt:hilt-compiler:$hilt_view_models"
def fragment_ktx = "1.6.0-alpha01"
implementation "androidx.fragment:fragment-ktx:$fragment_ktx"
def liveData_ktx="2.5.1"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$liveData_ktx"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.6.0"


def room = "2.4.3"
implementation "androidx.room:room-runtime:$room"
implementation "androidx.room:room-ktx:$room"
kapt "androidx.room:room-compiler:$room"
implementation 'com.google.code.gson:gson:2.8.9'


def navigation_version="2.5.1"
implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"

/*
Tests
*/
// Hilt
androidTestImplementation "com.google.dagger:hilt-android-testing:$hilt_version"
kaptAndroidTest "com.google.dagger:hilt-android-compiler:$hilt_version"
def fragmentTest_version = "1.3.0-alpha08"
debugImplementation "androidx.fragment:fragment-testing:$fragmentTest_version"
def activityTest_version = "1.4.0"
androidTestImplementation "androidx.test:core-ktx:$activityTest_version"
}

kapt {
correctErrorTypes true
}

Gradle-wrapper特性:

#Sun Sep 11 04:08:59 AST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

Grade.properties:

org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.enableJetifier=true
warning-mode=all
android.nonTransitiveRClass=true

setting.gradel:

include ':app'
rootProject.name = "MenuPro1.0"

原来是compileSdkVersion我用的是33所以我把它退回到30,一切都很好

感谢以下评论:https://stackoverflow.com/a/72880180/15828912

最新更新