1

我使用集成了 openCV 的项目: https ://github.com/joaopedronardari/OpenCV-AndroidSamples

该项目使用“gradle experimental:0.2.0”,我想导入我的 OCR tesseract,但 android 无法加载库:

System.loadLibrary("pngt");

在旧的 gradle 中,它的工作正常,这里是我的 gradle.build,旧的:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
    }
}

apply plugin: 'android-library'

android {
    compileSdkVersion 8
    buildToolsVersion "23.0.1"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
    }

    sourceSets.main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['src']
        res.srcDirs = ['res']
        jniLibs.srcDirs = ['libs']
    }
}

和新的:

apply plugin: 'com.android.model.library'

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle-experimental:0.2.0'
    }
}

model {
    android {
        compileSdkVersion = 8
        buildToolsVersion = "23.0.1"

        defaultConfig.with {
            minSdkVersion.apiLevel = 8
            targetSdkVersion.apiLevel = 19
            applicationId = 'tess_two'
        }
    }
    android.buildTypes {
        release {
            minifyEnabled = false
//            proguardFiles += file('proguard-rules.pro')
        }
    }
    android.sources {
        main {
            jniLibs {
                source {
                    srcDir 'libs'
           // Here my .so files of tesseract in old build jniLibs.srcDirs = ['libs']
                }
            }
            java {
                source {
                    srcDir 'src'
                }
            }
            resources {
                source {
                    srcDir 'src'
                }
            }

            res {
                source {
                    srcDir 'res'
                }
            }
        }
    }
4

0 回答 0