Problems not seeing Android xml layout (Gradle build problem)

Asked 2 years ago, Updated 2 years ago, 124 views

https://mplatform.seoul.go.kr/w/contest/award/2016/wnpz/selectPageListWinner.do

I didn't know how to play Android, so I tried to open an open source and study, but it worked, but the layout preview didn't come up properly. So I was googling to solve it, but I ended up asking a question because I got a bigger error.

1) When I opened the open source, I couldn't see the layout preview.

2) So when I googled the error message, I saw a stack overflow post, and I knew that Gradle was wrong, but I couldn't apply it because the gradle code shown there was different from my gradle code. (I tried copying and pasting the answers, but they didn't work)

3) There was a red line on my Gradle code, and I googled it with that error code. ( compile 'com.android.support:appcompat-v7:23.4.0' )

The code for that red line is as follows. build.gradle (Module: app)

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 23
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "com.runfive.hangangrunner"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }

    dexOptions {
        jumboMode true
        javaMaxHeapSize "2g"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.android.support:design:23.4.0'
    //compile 'com.naver.maps.open:naver-map-api:2.1.2@aar'Change to Google Maps
    compile project(':decoviewlib')
    compile project(':calendarlib')
    compile 'com.google.android.gms:play-services:9.0.2'
    compile 'com.google.android.gms:play-services:7.5.+'
    //compile 'com.google.android.gms:play-services-maps:9.4.0'
    //compile 'com.google.android.gms:play-services:9.4.0'
    compile 'com.google.maps.android:android-maps-utils:0.4'
    compile 'com.squareup.okhttp:okhttp:2.7.2'
    compile 'com.google.code.gson:gson:2.6.2'
    // Written by daily fragment

    // Facebook link
    compile 'com.facebook.android:facebook-android-sdk:4.6.0'

    // Naver login link
    compile files('libs/3rdparty_login_library_android_4.1.4.jar')

    // Card View
    compile 'com.android.support:recyclerview-v7:23.4.0'
    compile 'com.android.support:cardview-v7:23.4.0'

    // Font
    compile 'com.tsengvn:Typekit:1.0.0'

    // Subversion Support
    compile 'com.android.support:multidex:1.0.0'
}

I searched the red line first. However, even if I tried copying and pasting the answer, the error could not be solved.

https://stackoverflow.com/questions/39188699/failed-to-resolve-com-android-supportappcompat-v723-4-0

So I googled the error code below.

I googled and found a tea story blog.

According to the blog, "In Android Studio 3.1.0 and later versions, these build errors appear in existing projects, so add the code below."

http://dwfox.tistory.com/73

So I added those three lines to the code as the blog told me to.

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
   dependencies {
       classpath 'com.android.tools.build:gradle:3.0.1'
       classpath 'com.android.tools.build:gradle:1.3.0-beta1'
       classpath 'com.google.gms:google-services:1.3.0-beta1'

       compile 'com.android.support:appcompat-v7:25.3.0' //Google Component
       compile 'com.android.support:customtabs:25.3.0'
       compile 'com.android.support:mediarouter-v7:25.3.0'

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

allprojects {
    repositories {
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Then, this time, a new error appeared.

Please install the Android Support Repository from the Android SDK Manager.

When I googled and pasted the answers to solve the problem, a new error appears again...

I'm repeating this like an infinite loop. How do we solve this?

android xml layout gradle build

2022-09-21 21:37

1 Answers

Ah...You have to check the correct version for this Gradle and choose it.

I've been there before. You can go to sdk manager and check sdk tools Please check the sdk platform there and put the one on the error side (version)


2022-09-21 21:37

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.