简体   繁体   English

Gradle 错误:统一 android 构建中的冲突属性

[英]Gradle Error: Colliding attributes in unity android build

Im trying to make an android plugin for my unity project.我试图为我的统一项目制作一个 android 插件。 I have the aar file in my Assets/Plugins/Android folder.我的 Assets/Plugins/Android 文件夹中有 aar 文件。 I have also put relevant build settings (package name, min api level etc).我还放置了相关的构建设置(包名称、最低 api 级别等)。

But when I try to build an apk, i get the following error.但是当我尝试构建一个 apk 时,我收到以下错误。 enter image description here在此处输入图像描述

Im trying to access the code like so:我试图像这样访问代码:

        TextMesh textMesh = GetComponent<TextMesh>();
        var plugin =new AndroidJavaClass("cn.easyar.samples.helloarvideo.MainActivity");
        textMesh.text = plugin.CallStatic<string>("getUtsavString", 17);
        print("my print stmt: " + plugin.CallStatic<string>("getUtsavString", 17));

Note that my MainActivity.java class looks like this:请注意,我的 MainActivity.java class 看起来像这样:

//================================================================================================================================
//
// Copyright (c) 2015-2020 VisionStar Information Technology (Shanghai) Co., Ltd. All Rights Reserved.
// EasyAR is the registered trademark or trademark of VisionStar Information Technology (Shanghai) Co., Ltd in China
// and other countries for the augmented reality technology developed by VisionStar Information Technology (Shanghai) Co., Ltd.
//
//================================================================================================================================

package cn.easyar.samples.helloarvideo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class MainActivity extends Activity
{
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        findViewById(R.id.button_start).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity.this, ARActivity.class));
            }
        });
    }

    public static String getUtsavString(int a){
        return "number: "+a;
    }
}

But in order to test this I need to build the apk, which gives the above error (see image)但为了测试这一点,我需要构建 apk,它给出了上述错误(见图)

Any help would be appreciated任何帮助,将不胜感激

I guess you have two attributes in the AndroidManifest.xml我猜你在 AndroidManifest.xml 中有两个属性

1:in the lib-> xx.aar/AndroidManifest.xml xx--applicatio@icon=@mipmap/app_icon 1:在lib-> xx.aar/AndroidManifest.xml xx--applicio@icon=@mipmap/app_icon

2:in the unity -> Assets/Plugins/Android/AndroidManifest.xml xx--applicatio@icon=@mipmap/app_icon 2:在统一-> Assets/Plugins/Android/AndroidManifest.xml xx--applicio@icon=@mipmap/app_icon

tow attributes is dissimilarity;两个属性是不同的;

so, you can del lib or unity AndroidManifest config attributes;因此,您可以删除 lib 或统一 AndroidManifest 配置属性;

You can see see Yes or Yes.您可以看到是或是。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM