1

At Android Studio the XML layout when you type for example <TextView you expect that the auto-suggestion doesn't give me "match_parent" or "wrap_content" choice on the width and height attribute like the photo : image 1

and also for the ID attribute I don't get any suggestion and can only write it fully to add it like this photo : image 2

Note : I don't think that the problem with the android studio because with another project it works fine as expected like this photo : image 3 and this : image 4

the different is I changed in the cradle set up, and I really don't know what I did wrong I tried to compare the different between the two projects but nothing helped

This is the new Gradle set up : can anyone help please...

Gradle(project-level)

// 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(Module-level):

    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.properties:

    #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

Gradel.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"
RaBaKa 78
  • 1,115
  • 7
  • 11

1 Answers1

0

turned out to be the compileSdkVersion I was using 33 so I returned it to 30 and every thing worked fine

thanks to this comment : https://stackoverflow.com/a/72880180/15828912