如何在android studio中导入Android-DirectoryChooser

时间:2017-03-06 17:30:59

标签: android android-library android-maven-plugin

我正在尝试使用此目录选择器:Android-DirectoryChooser。 我已经尝试根据说明添加From Maven Central但是得到了这个错误:

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@theme value=(@style/MyMaterialTheme.Base) from AndroidManifest.xml:15:5-48
    is also present at [net.rdrei.android.dirchooser:library:3.2] AndroidManifest.xml:9:18-62 value=(@style/DirectoryChooserTheme).
    Suggestion: add 'tools:replace="android:theme"' to <application> element at AndroidManifest.xml:9:1-40:15 to override.

的AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.audiorecorder.wel.voicerecorder">

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:launchMode="singleTop"
    android:theme="@style/MyMaterialTheme.Base"
    android:hardwareAccelerated="false"
    android:largeHeap="true">
    <activity android:name="voicerecorder.wel.audiorecorder.com.voicerecorder.MainActivity" android:windowSoftInputMode="adjustPan"> >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
</application>
</manifest>

的build.gradle(项目):

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

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'commons-io:commons-io:2.5'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

repositories {
    mavenLocal()
}

的build.gradle(模块):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.audiorecorder.wel.voicerecorder"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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'
    })
    compile 'com.android.support:appcompat-v7:25.2.0'
    testCompile 'junit:junit:4.12'
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:design:25.1.0'
    compile "commons-io:commons-io:+"
    compile 'net.rdrei.android.dirchooser:library:3.2@aar'

}

如何解决此错误?我的项目和图书馆的主题存在问题。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

我猜你应该将tools:replace="android:theme"添加到你的清单到应用程序元素