Unity ARCORE DllNotFoundException:arcore_unity_api

时间:2019-04-21 14:54:29

标签: android unity3d

我尝试从Unity导出项目,然后从Android Studio将其导出为库,但是当我将该库导入另一个项目时,出现此错误:E / Unity:无法找到arpresto_api

(如果我在不导出为库的情况下运行它,那么一切正常)

任何帮助将不胜感激。

已经尝试过Unity + ARCORE DllNotFoundException: arcore_unity_api 它不起作用。

等级:

??

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
}
}

allprojects {
    repositories {
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
}

apply plugin: 'com.android.library'


dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation(name: 'arcore_client', ext:'aar')
    implementation(name: 'arcore_unity', ext:'aar')
    implementation(name: 'google_ar_required', ext:'aar')
    implementation(name: 'unityandroidpermissions', ext:'aar')
    implementation(name: 'unitygar', ext:'aar')
}

android {
    compileSdkVersion 26
    buildToolsVersion '28.0.3'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion 26
        targetSdkVersion 28
        ndk {
            abiFilters 'armeabi-v7a', 'x86'
        }
        versionCode 1
        versionName '0.1'
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress = ['.unity3d', '.ress', '.resource', '.obb']
    }

    buildTypes {
        debug {
            minifyEnabled false
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
            jniDebuggable true
        }
        release {
            minifyEnabled false
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
            signingConfig signingConfigs.debug
        }
    }

    packagingOptions {
        doNotStrip '*/armeabi-v7a/*.so'
        doNotStrip '*/x86/*.so'
    }

    splits {
        language {
            enable false
        }
        density {
            enable false
        }
        abi {
            enable true
        }
    }
}

1 个答案:

答案 0 :(得分:0)

设法通过将文件夹[ jniLibs 资产 libs ]与库一起添加到我的项目中来解决该问题。

当您将UnityProject导出为库时,这似乎是一个问题。

将这些文件夹从UnityProject(从Unity导出的版本)复制并粘贴到您导入库的项目中,然后在清单和Gradle(app)文件中进行一些更改。 确保文件夹位于正确的位置。

应该位于:yourApp / app /

jniLibs 应该位于:yourApp / app / src / main / jniLibs

资产应位于:yourApp / app / src / main / 资产

版本更改。

db.collection.deleteMany({ 'myField': null})

清单文件。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.something.ar"
        minSdkVersion 26
        targetSdkVersion 28
        ndk {
            abiFilters 'armeabi-v7a', 'x86'
        }
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }

    aaptOptions {
        noCompress = ['.unity3d', '.ress', '.resource', '.obb']
    }

    packagingOptions {
        doNotStrip '*/armeabi-v7a/*.so'
        doNotStrip '*/x86/*.so'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation(name: 'arcore_client', ext:'aar')
    implementation(name: 'arcore_unity', ext:'aar')
    implementation(name: 'google_ar_required', ext:'aar')
    implementation(name: 'unityandroidpermissions', ext:'aar')
    implementation(name: 'unitygar', ext:'aar')
    implementation project(':ar_demo')
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}