嵌入Android应用程序中的Unity

嵌入Android应用程序中的Unity

本文介绍了嵌入Android应用程序中的Unity(Vuforia)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里有完全相同的问题,不同之处在于




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


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





$ b $版本:2018.3.6f1



Vuforia版本:8.1.7



Android APP Gradle

 应用插件:'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否
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'
}
}
}

依赖项{
实现fileTree(dir:'libs',包括:['* .jar'])
实现'com.android.support:appcompat-v7:28.0.0'
实现'com.android.support.constraint:constraint-layout:1.1.3'
实现'com.android.support:support-v4:28.0.0'
实现'com.android.support :recyclerview-v7:28.0.0'
testImplementation'junit:junit:4.12'
androidTestImplementation'com.android.support.test:runner:1.0.2'
实现(名称:' DressAR-debug',ext:'aar')
实现(名称:'VuforiaWrapper',ext:'aar')
}

Unity APP Gradle

  //由联合国产生。删除此评论,以防止再次导出时出现过大的负担

buildscript {
储存库{
google()
jcenter()
}

依赖项{
classpath'com.android.tools.build:gradle:3.2.0'
}
}

allprojects {
储存库{
google()
jcenter()
flatDir {
dirs'libs'
}
}
}

Apply插件:'com.android.library'


依赖项{
实现fileTree(dir:'libs',include:['* .jar'])
实施(名称:'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
}
}

包装选项{
doNotStrip'* / armeabi-v7a /*.so'
doNotStrip'* / x86 / *。so'
}

}


解决方案

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




  1. 打开Unity构建设置

  2. 在android播放器设置中,将脚本后端更改为IL2CPP

  3. 在android播放器设置中,将ARM64复选框标记为选中。

  4. 然后再次导出。


i have the exact same problem here with the different that

  • when i added vuforia wrapper unity application got crashed before lunching

  • if i didn't add vuforia wrapper the unity app open and behave normally but with black screen instead of camera

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

Unity Version: 2018.3.6f1

Vuforia version: 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'
    }

}
解决方案

I have the same error with you I have searched for a lot of tutorials and I found this post and it worked on my project, good luck

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

  1. Open Unity Build Setting
  2. In android player settings change "scripting backend" to IL2CPP.
  3. In android player settings mark ARM64 checkbox as selected.
  4. Then export again.

这篇关于嵌入Android应用程序中的Unity(Vuforia)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 23:55