简体   繁体   中英

Gradle Error: Colliding attributes in unity android build

Im trying to make an android plugin for my unity project. I have the aar file in my Assets/Plugins/Android folder. I have also put relevant build settings (package name, min api level etc).

But when I try to build an apk, i get the following error. 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:

//================================================================================================================================
//
// 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)

Any help would be appreciated

I guess you have two attributes in the AndroidManifest.xml

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

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

tow attributes is dissimilarity;

so, you can del lib or unity AndroidManifest config attributes;

You can see see Yes or Yes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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