2014-12-26 6 views
1

지금 당장이 기능을 사용하려고합니다. 이 라이브러리에서RenderScript V8 여러 개의 덱스 파일이 정의되었습니다.

apply plugin: 'android-library' 

dependencies { 
    compile fileTree(dir: 'libs', include: '*.jar') 
    compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar') 
} 

android { 
    compileSdkVersion 21 
    buildToolsVersion '21.1.2' 

    defaultConfig { 
     renderscriptTargetApi 19 
     renderscriptSupportModeEnabled true 
    } 

sourceSets { 
    main { 
     manifest.srcFile 'AndroidManifest.xml' 
     java.srcDirs = ['src'] 
     resources.srcDirs = ['src'] 
     aidl.srcDirs = ['src'] 
     renderscript.srcDirs = ['src'] 
     res.srcDirs = ['res'] 
     assets.srcDirs = ['assets'] 
    } 

    // Move the tests to tests/java, tests/res, etc... 
    instrumentTest.setRoot('tests') 

    // Move the build types to build-types/<type> 
    // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... 
    // This moves them out of them default location under src/<type>/... which would 
    // conflict with src/ being used by the main source set. 
    // Adding new build types or product flavors should be accompanied 
    // by a similar customization. 
    debug.setRoot('build-types/debug') 
    release.setRoot('build-types/release') 
} 
} 

    task nativeLibsToJar(type: Zip, description: 'create a jar archive of the native libs') { 
     destinationDir file("$buildDir/native-libs") 
     baseName 'native-libs' 
     extension 'jar' 
     from fileTree(dir: 'libs', include: '**/*.so') 
     from fileTree(dir: 'renderscript', include: '**/*.so') 
     into 'lib/' 
    } 

    tasks.withType(JavaCompile) { 
     compileTask -> compileTask.dependsOn(nativeLibsToJar) 
    } 

모든 것이 완벽하게 작동 : 나는 모듈 StackBlur https://github.com/kikoso/android-stackblur 을 사용하고
이 같은 Graddle 파일이 모습입니다. 그러나, 내 자신의 프로젝트에서 RenderScript를 사용하려고 할 때, 내 자신의 코드로. 문제가 시작됩니다. 내 앱 graddle 파일에 RenderScript을 넣지 않으면 나는 오류 얻을 :

Error loading RS jni library: java.lang.UnsatisfiedLinkError: Couldn't load RSSupport from loader dalvik.system.PathClassLoader[]: findLibrary returned null

을 그리고 난 내 자신의 Graddle 파일에 renderscript 값을 넣을 때, 덱스 파일 예외가있을 시작합니다

UNEXPECTED TOP-LEVEL 예외 : 그들은 모두 RenderScriptSupportEnabled 진실하고 RenderScriptTargetApi를 추가하기 때문에

com.android.dex.DexException: Multiple dex files define Landroid/support/v8/renderscript/Allocation$1; 

dexfile 예외는 분명히 발생합니다. 그러나 나는 그들이 모두 일할 수있게하기 위해 내가해야 할 일을 모른다. 내 graddle에서 렌더 스크립트를 삭제할 때마다 프로젝트가 작동하지 않지만 StackBlur 모듈에서 렌더러를 삭제하면 해당 프로젝트가 작동하지 않습니다.

제안 사항이 있으십니까?
이 내 graddle 파일 : 나는이 선이 나에게 문제를 준 발견

apply plugin: 'com.android.application' 
android { 
    compileSdkVersion 21 
    buildToolsVersion "21.1.2" 
    defaultConfig { 
     applicationId "package.name.app" 
     minSdkVersion 17 
     targetSdkVersion 21 
     versionCode 1 
     versionName "1.0" 
     renderscriptSupportModeEnabled true 
     renderscriptTargetApi 19 

    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 
dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile 'com.android.support:appcompat-v7:21+' 
    compile 'com.android.support:support-v4:21.0.2' 
    compile 'com.android.support:cardview-v7:21.0.+' 
    compile 'com.android.support:recyclerview-v7:21.0.+' 
    compile project(':StackBlur') 
} 

답변

2

음 26 시도 후 :

dependencies { 
    compile fileTree(dir: 'libs', include: '*.jar') 
    compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar') 
} 

내가이를 제거하고 프로젝트를 청소했다.

+0

프로젝트를 정리하면 문제가 해결되었습니다. 제안 해 주셔서 감사합니다. – TheIT

관련 문제