Unity工程导出到Android Studio出错

项目需要在Unity中用到音视频通话以及实时消息,但声网RTM实时消息没有Unity版本,目前做法是在Unity中集成SDK完成音视频后导出到Android Studio中加入实时消息功能,在Android Studio进行编译时报错:

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file 'F:\ARProject\androidBuild\unityLibrary\build.gradle' line: 8

* What went wrong:
A problem occurred evaluating project ':unityLibrary'.
> Project with path 'AgoraRtcEngineKit.plugin' could not be found in project ':unityLibrary'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log         output. Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':unityLibrary'.
> compileSdkVersion is not specified. Please add it to build.gradle

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log     output. Run with --scan to get full insights.
==============================================================================

报错位置:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project('AgoraRtcEngineKit.plugin')
}

请教解决方法或更好的开发方式。

看下build.gradle里,NDK这里写的是什么?

已解决,谢谢

怎么解决的啊,求教

首先在setting.gradle中加入(注意路径):

include ':AgoraRtcEngineKit.plugin'

project(':AgoraRtcEngineKit.plugin').projectDir=new File('..\\androidBuild\\unityLibrary\\AgoraRtcEngineKit.plugin')

然后将出错的地方(库的build.gradle)改为:

implementation project(':AgoraRtcEngineKit.plugin')

希望可以帮到你。

1 个赞