如何统一解决``类名(...)与路径(...)不匹配''错误

时间:2019-01-03 03:32:26

标签: android-studio unity3d

我正在Android Studio中编写一个新的AAR插件。它仅包含一个简单的Java类:

package com.neitron.shareplugin;

public class ShareProvider {
    private static final ShareProvider ourInstance = new ShareProvider();

    public static ShareProvider getInstance() {
        return ourInstance;
    }

    private ShareProvider() {
    }

    public String GetTestMesssage(int num)
    {
        return "Num is: " + num;
    }
}

然后我构建了它,并将AAR文件复制到Unity [2018.2.11f1]:

../Assets/Plugins/Android/shareplugin-release.aar

当我试图统一构建项目时,会引发异常:

CommandInvokationFailure: Gradle build failed. 
C:/Program Files/Java/jdk1.8.0_181\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2018.2.11f1\Editor\Data\PlaybackEngines\AndroidPlayer\To 
ols\gradle\lib\gradle-launcher-4.2.1.jar" org.gradle.launcher.GradleMain "- 
Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"

stderr[
Dex: Error converting bytecode to dex:
Cause: PARSE ERROR:
class name (com/neitron/shareplugin/R) does not match path 
(com/Neitron/shareplugin/R.class)
...while parsing com/Neitron/shareplugin/R.class

PARSE ERROR:
class name (com/neitron/shareplugin/R) does not match path 
(com/Neitron/shareplugin/R.class)
...while parsing com/Neitron/shareplugin/R.class

Dex: Error converting bytecode to dex:
Cause: PARSE ERROR:
class name (com/neitron/shareplugin/R$attr) does not match path 
(com/Neitron/shareplugin/R$attr.class)
...while parsing com/Neitron/shareplugin/R$attr.class

PARSE ERROR:
class name (com/neitron/shareplugin/R$attr) does not match path 
(com/Neitron/shareplugin/R$attr.class)
...while parsing com/Neitron/shareplugin/R$attr.class

依此类推(

我错过了任何有趣的技巧吗?我已经尝试在Android Studio中清理构建,检查所有清单文件。没有com.Neitron.sharepludin路径,只有com.neitron.shareplugin。另外,我试图创建一个空白插件和空白测试统一项目,并且遇到相同的问题。

0 个答案:

没有答案