Reputation: 59004
#StrangeError This issue persists when I changed my system. I opened a project in a new laptop. Now I can run an app, Gradle build is successful but all dependency imports show not resolved like the screenshot.
Note that all dependencies are added in-app level build.gradle
and project is running perfectly.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "in.kpis.servertracker"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
dataBinding {
enabled = true
}
buildTypes {
debug {
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
def SUPPORT_LIB_VER = '27.0.2'
def BUTTER_KNIFE_VER = '8.8.1'
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':Baselib')
implementation "com.android.support:appcompat-v7:$SUPPORT_LIB_VER"
implementation "com.android.support:design:${SUPPORT_LIB_VER}"
implementation "com.android.support:cardview-v7:${SUPPORT_LIB_VER}"
implementation "com.android.support:recyclerview-v7:${SUPPORT_LIB_VER}"
implementation "com.jakewharton:butterknife:${BUTTER_KNIFE_VER}"
annotationProcessor "com.jakewharton:butterknife-compiler:${BUTTER_KNIFE_VER}"
}
Gradle build is successful, it does not show any error.
I have tried
Upvotes: 2
Views: 1854
Reputation: 2319
That sometimes happen in your project.
So you need to Delete your .Gradle folder in your project directory.
Projectdirectory->.gradle folder Delete it And
Then open Android Studio and build project
Thanks!
Upvotes: 1