嵌入Android应用程序中的Unity(Vuforia)

时间:2019-04-04 12:09:17

标签: android unity3d augmented-reality vuforia android-augmented-reality

我这里有完全相同的问题,与

不同
  • 当我添加vuforia包装器统一应用程序时,在午餐前崩溃了

  • 如果我未添加vuforia包装器,则统一应用会打开并正常运行,但使用黑屏而不是相机

Unity (Vuforia) project integrated in Android project shows a black screen on startup

统一版本:2018.3.6f1

Vuforia版本:8.1.7

Android APP Gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.myfit"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

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 'com.android.support:recyclerview-v7:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    implementation(name: 'DressAR-debug', ext:'aar')
    implementation(name: 'VuforiaWrapper', ext:'aar')
}

Unity APP Gradle

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN

buildscript {
    repositories {
        google()
        jcenter()
    }

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

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

apply plugin: 'com.android.library'


dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation(name: 'VuforiaWrapper', ext:'aar')
}

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion 16
        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'
    }

}

1 个答案:

答案 0 :(得分:0)

我在搜索很多教程时遇到了与您相同的错误,我发现了这篇文章,它对我的​​项目很有用,祝您好运

No implementation found for void com.unity3d.player.UnityPlayer.nativeRestartActivityIndicator()

  1. 打开Unity构建设置
  2. 在android播放器设置中,将“脚本后端”更改为IL2CPP。
  3. 在android播放器设置中,将ARM64复选框标记为选中。
  4. 然后再次导出。