Boby Siwonhansamu
Boby Siwonhansamu

Reputation: 175

Build complete and running but showing error on class android

i have some strange error / bug on android studio, my application gradle is complete and running smoothly on device but its showing error like my library is not completely include on android studio, i already do

  1. Clean then Rebuild
  2. Invalidate Cache and restart

but nothing work, this is the screenshot Error importing and everything who use the class

Success gradle

This is My App Gradle

android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
    applicationId "com.host.appname"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
    useLibrary 'org.apache.http.legacy'
    vectorDrawables.useSupportLibrary = true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        lintOptions {
            disable 'MissingTranslation'
        }
    }
}
productFlavors {
}
packagingOptions {
    exclude 'META-INF/NOTICE.txt' // will not include NOTICE file
    exclude 'META-INF/LICENSE.txt' // will not include LICENSE file
}

and this is my project gradle

    buildscript {
        repositories {
            jcenter()
            flatDir {
                dirs 'libs'
            }
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.3.3'
        }
    }

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

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

So i can run my application, i can use it but its really disturbing for me to do code because i cannot use autocomplete regarding the error libs and red marks everywhere .

Thank You..

Upvotes: 1

Views: 599

Answers (1)

nimi0112
nimi0112

Reputation: 2135

  1. Remove the lines and re-import them from correct/compatible packages.
  2. Try removing all dependencies then sync and add all dependencies again then sync.

As you mentioned in comments nimi0112 and Ali Ahmed's your answer is really helped me a lot.

Upvotes: 1

Related Questions