Android Studio显示未使用的语句

时间:2016-11-17 10:52:04

标签: android import

从我的语言环境磁盘中包含gradle项目后,我遇到了import语句的问题。

在我的gradle中使用themoviedbapi作为编译语句之前。

现在我需要修改一些对象。我下载了lib,将其移到我的Project文件夹(app文件夹之外),然后将lib添加到gradle compile project(':themoviedbapi')

导入效果很好,但所有import语句都显示为未使用。对象也标有红色Cannot resolve symbol xxx

如果我尝试编译项目,则没有错误。 如果我删除"未使用的" import语句我在编译时遇到错误。

android studio restart没有解决问题。

你有什么想法,以及如何解决它?

更新1

我的项目:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion '24.0.3'
    defaultConfig {
        applicationId "com.example.philipp.serieswatchlist"
        minSdkVersion 17
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
    }
    dataBinding {
        enabled = true
    }
    sourceSets { main { java.srcDirs = ['src/main/java', 'src/main/java/models'] } }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
        exclude module: 'httpclient'
    })
    //compile 'com.omertron:themoviedbapi:4.3'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    //compile 'info.movito:themoviedbapi:1.4'
    compile 'com.android.support:cardview-v7:24.2.1'
    compile 'com.android.support:recyclerview-v7:24.2.1'
    compile 'com.android.support:support-v4:24.2.1'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    testCompile 'junit:junit:4.12'
    compile 'com.jakewharton:butterknife:6.1.0'
    compile project(':themoviedbapi')
}

电影DB api:

apply plugin: 'java'
apply plugin: 'maven'

group = 'info.movito'
version = '1.5-SNAPSHOT'

description = """TMDB-API"""

sourceCompatibility = 1.6
targetCompatibility = 1.6



repositories {

     maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version:'2.4.4'
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version:'2.4.4'
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version:'2.4.4'
    compile group: 'org.slf4j', name: 'slf4j-api', version:'1.7.7'
    compile group: 'org.apache.commons', name: 'commons-lang3', version:'3.3.2'
    compile group: 'commons-codec', name: 'commons-codec', version:'1.10'
    compile group: 'org.slf4j', name: 'jcl-over-slf4j', version:'1.7.7'
    compile group: 'com.google.guava', name: 'guava', version:'18.0'
    testCompile group: 'junit', name: 'junit', version:'4.11'
    compile(group: 'org.yamj', name: 'api-common', version:'1.1') {
       /* This dependency was originally in the Maven provided scope, but the project was not of type war.
       This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
       Please review and delete this closure when resolved. */
    }
}

设定:

include ':app', ':themoviedbapi'

0 个答案:

没有答案