2016-11-17 48 views
1

我想在AndroidStudio中導入GPUImage。所以我從這裏下載了這個https://github.com/CyberAgent/android-gpuimage的GPUImage庫,然後我參考了這個鏈接http://pixsterstudio.com/use-gpuimage-library-android-part-1-gpuimage-integration.html 知道我想如何導入GPUImage庫。但是,隨後Android Studo給了我下面的錯誤,它被鏈接到下面發佈的庫/ build.gradle。如何添加ID爲'com.novoda.bintray-release'的插件GPUImage

錯誤信息

Error:(2, 0) Plugin with id 'com.novoda.bintray-release' not found 

請讓我知道如何糾正這一錯誤,以及如何正確導入GPUImage庫?

庫/的build.gradle

apply plugin: 'com.android.library' 
apply plugin: 'com.novoda.bintray-release' 

android { 
compileSdkVersion COMPILE_SDK_VERSION as int 
buildToolsVersion BUILD_TOOLS_VERSION 

defaultConfig { 
    minSdkVersion MIN_SDK_VERSION as int 
    targetSdkVersion TARGET_SDK_VERSION as int 

    versionCode "git rev-list origin/master --count".execute().text.toInteger() 
    versionName VERSION_NAME 

    consumerProguardFiles 'proguard-rules.txt' 

    ndk { 
     moduleName "gpuimage-library" 
     stl "gnustl_shared" 
     abiFilters "all" 
     ldLibs "log" 
    } 
} 

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

    instrumentTest.setRoot('tests') 
} 

lintOptions { 
    abortOnError false 
} 
} 

task androidJavadocs(type: Javadoc) { 
source = android.sourceSets.main.java.srcDirs 
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 
} 

task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { 
classifier = 'javadoc' 
from androidJavadocs.destinationDir 
} 

task androidSourcesJar(type: Jar) { 
classifier = 'sources' 
from android.sourceSets.main.java.srcDirs 
} 

artifacts { 
archives androidSourcesJar 
archives androidJavadocsJar 
} 

publish { 
userOrg = POM_DEVELOPER_ID 
groupId = GROUP 
artifactId = ARTIFACT_ID 
publishVersion = VERSION_NAME 
desc = POM_DESCRIPTION 
website = POM_URL 
} 










W/System.err:  at org.opencv.android.OpenCVLoader.initDebug(OpenCVLoader.java:66) 
W/System.err:  at org.opencv.android.OpenCVLoader.initDebug(OpenCVLoader.java:66) 
W/ContextImpl: Implicit intents with startService are not safe: Intent { act=org.opencv.engine.BIND } android.content.ContextWrapper.bindService:604 org.opencv.android.AsyncServiceHelper.initOpenCV:24 org.opencv.android.OpenCVLoader.initAsync:89 
E/OpenCVLoader/BaseLoaderCallback: OpenCV loading failed! 
+0

看起來像是具有上的依賴關係舊版本的'org.opencv.android'。 「gradle依賴關係 - 配置編譯」的輸出是什麼? – JBirdVegas

回答

5

我解決了通過修改的build.gradle文件中的問題,如圖belwo

的build.gradle 「項目:GPUImageTest00」

// 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.2' 
    classpath 'com.novoda:bintray-release:0.3.4' 

    // NOTE: Do not place your application dependencies here; they belong 
    // in the individual module build.gradle files 
} 
} 

allprojects { 
repositories { 
    jcenter() 
} 
} 

task clean(type: Delete) { 
delete rootProject.buildDir 
} 

build.gradle「module:app」

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 24 
buildToolsVersion "24.0.3" 
defaultConfig { 
    applicationId "com.example.gpuimagetest_00" 
    minSdkVersion 18 
    targetSdkVersion 18 
    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:24.2.1' 
testCompile 'junit:junit:4.12' 
compile project(':library') 
} 

的build.gradle 「模塊:庫」

apply plugin: 'com.android.library' 
apply plugin: 'com.novoda.bintray-release' 

android { 
compileSdkVersion 24 
buildToolsVersion "24.0.3" 

defaultConfig { 
    minSdkVersion 18 
    targetSdkVersion 18 

    versionCode 1 
    versionName "1.0" 

    consumerProguardFiles 'proguard-rules.txt' 

    ndk { 
     moduleName "gpuimage-library" 
     stl "gnustl_shared" 
     abiFilters "all" 
     ldLibs "log" 
    } 
} 

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

    instrumentTest.setRoot('tests') 
} 

lintOptions { 
    abortOnError false 
} 
} 

task androidJavadocs(type: Javadoc) { 
source = android.sourceSets.main.java.srcDirs 
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 
} 

task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { 
classifier = 'javadoc' 
from androidJavadocs.destinationDir 
} 

task androidSourcesJar(type: Jar) { 
classifier = 'sources' 
from android.sourceSets.main.java.srcDirs 
} 

artifacts { 
archives androidSourcesJar 
archives androidJavadocsJar 
} 

publish { 
userOrg = 'novoda' 
groupId = 'com.novoda' 
artifactId = 'bintray-release' 
publishVersion = '0.3.4' 
desc = 'Oh hi, this is a nice description for a project, right?' 
website = 'https://github.com/novoda/bintray-release' 
} 

的build.gradle模塊:樣品

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 24 
buildToolsVersion "24.0.3" 

defaultConfig { 
    minSdkVersion 18 
    targetSdkVersion 18 
} 

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

    instrumentTest.setRoot('tests') 
} 

lintOptions { 
    abortOnError true 
} 
} 
repositories { 
jcenter() 
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } 
} 

dependencies { 
compile project(':library') 
// compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1' 
compile 'com.android.support:appcompat-v7:24.2.1' 
}