Android Studio错误导入库

时间:2017-06-09 07:52:44

标签: android

我有2个项目。在第一个库(来自GitHub的android-range-seek-bar)工作正常

但在复制到第二个项目后 - 我有错误。非常奇怪的错误(对我来说)。重建,清除,无效的缓存没有帮助:(

在app gradle中添加依赖项:

compile project(':rangeseekbar')

和settings.gradle是:

include ..., ':rangeseekbar', ...
project(':rangeseekbar').projectDir = new File('app/libs/rangeseekbar')

我的xml是:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:rsb="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
...
<org.florescu.android.rangeseekbar.RangeSeekBar
                android:id="@+id/yourage"
                android:layout_width="180dp"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginRight="15dp"
                android:layout_weight="0.74"
                rsb:absoluteMaxValue="60"
                rsb:absoluteMinValue="14"
                rsb:activateOnDefaultValues="true"
                rsb:barHeight="2dp"
                rsb:internalPadding="2dp"
                rsb:singleThumb="true"/>
...
</ScrollView>

但Android工作室告诉我:[编辑器截图有问题] https://i.stack.imgur.com/7fPDt.jpg

所以我从第一个项目添加了3个库:awesomevalidation,rangeseekbar,wizardpager - 所有这些libs导入错误:[screenshot] https://i.stack.imgur.com/W8n6w.jpg

第一个app(普通)gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.3'
    defaultConfig {
        applicationId "bla.bla.bla"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 10
        versionName '1.0'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
    lintOptions {
        checkReleaseBuilds false
    }
    useLibrary  'org.apache.http.legacy'
}

dependencies {
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:support-v13:25.3.1'
    compile 'com.android.support:gridlayout-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile project(':fancybuttons')
    compile project(':ckchangelog')
    compile project(':appintro')
    compile project(':rangeseekbar')
    compile project(':segmentedcontrol')
    compile project(':awesomevalidation')
    compile project(':wizardpager')
    compile project(':bubbleview')
    compile project(':dialogplus')
    compile project(':processbutton')
    compile project(':androidquery')
}

第二个app(问题)gradle:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"

    defaultConfig {
        applicationId "bla.bla"
        targetSdkVersion 26
        versionCode 1
        versionName "1"
        multiDexEnabled true
    }

    productFlavors {
        dev {
            minSdkVersion 16
        }
        prod {
            minSdkVersion 16
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    dataBinding {
        enabled = true
    }

    dexOptions {
        javaMaxHeapSize "2g"
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
    compile 'com.android.support:mediarouter-v7:26.0.0-alpha1'
    compile 'com.android.support:support-v13:26.0.0-alpha1'
    compile 'com.google.android.gms:play-services:11.0.0'
    compile 'com.android.support:design:26.0.0-alpha1'
    compile 'com.android.support:support-annotations:26.0.0-alpha1'
    compile 'com.squareup.retrofit2:retrofit:2.2.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.rengwuxian.materialedittext:library:2.1.4'
    compile 'com.google.code.gson:gson:2.8.0'
    compile 'com.kbeanie:image-chooser-library:1.6.0@aar'
    compile 'com.mobsandgeeks:android-saripaar:2.0.3'
    compile 'com.wdullaer:materialdatetimepicker:3.1.3'
    compile 'com.jaedongchicken:ytplayer:1.2.0'
    compile 'com.daimajia.slider:library:1.1.5@aar'
    compile 'com.android.support:cardview-v7:26.0.0-alpha1'
    compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
    compile 'com.squareup.okio:okio:1.11.0'
    compile 'com.squareup.okhttp3:okhttp:3.6.0'
    compile 'com.squareup.retrofit2:converter-gson:2.2.0'
    compile 'com.intellij:annotations:12.0'
    compile 'com.patrickpissurno:ripple-effect:1.3.1'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.google.maps.android:android-maps-utils:0.4.3'
    compile 'com.gvillani:pinnedlist:0.9.2'
    compile 'com.github.lzyzsd:circleprogress:1.2.1'
    compile 'com.github.smart-fun:XmlToJson:1.2.1'
    compile 'com.google.guava:guava:22.0-android'
    compile project(':storagechooser')
    compile project(':awesomevalidation')
    compile project(':rangeseekbar')
    compile project(':wizardpager')
}

0 个答案:

没有答案