简体   繁体   English

改变<application android:name="”${applicationName}”"> Flutter 项目的属性 (AndroidManifest.xml)</application>

[英]Changing the <application android:name=”${applicationName}”> attribute of a Flutter proyect (AndroidManifest.xml)

The company where I work want to import devices from Tuya (An IoT devices provider).我工作的公司想从涂鸦(物联网设备提供商)进口设备。 Tuya provides to their clients a native SDK to manage the devices.涂鸦为他们的客户提供了一个原生的 SDK 来管理设备。 The company where I work is interested in using this SDK in a Flutter project.我工作的公司有兴趣在 Flutter 项目中使用这个 SDK。

To integrate this SDK I need to do it natively in Java/Kotlin and Objective-C/Swift inside the Flutter Project.要集成这个 SDK,我需要在 Flutter 项目中使用 Java/Kotlin 和 Objective-C/Swift 本地完成。 Tuya supplies a guide to do it in those languages . Tuya 提供了使用这些语言的指南 Unfortunately, I'm having some complications adapting this guide to a Flutter Project.不幸的是,我在将本指南改编为 Flutter 项目时遇到了一些问题。 The main problem I'm having is the initialization of the SDK.我遇到的主要问题是 SDK 的初始化。 In the AndroidManifest.xml ( project\android\app\src\main\AndroidManifest.xml ) the <application android:name=””> attribute is already in use with ${applicationName} .AndroidManifest.xml ( project\android\app\src\main\AndroidManifest.xml ) <application android) 中,<application ${applicationName}中已经使用了<application android:name=””>属性: I need to modify it and I don't know how to.我需要修改它,我不知道该怎么做。

Works properly:正常工作:

public class TuyaSmartApp extends Application {
  @Override
  public void onCreate() {
    super.onCreate();

    TuyaHomeSdk.init(this);
    TuyaHomeSdk.setDebugMode(true);
  }
}
    <application
        android:name=".TuyaSmartApp"
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.MyTuyaApplication"
        tools:targetApi="31"
        tools:replace="android:allowBackup,android:supportsRtl">
        <meta-data
            android:name="TUYA_SMART_APPKEY"
            android:value="" />
        <meta-data
            android:name="TUYA_SMART_SECRET"
            android:value="" />
        <activity
            android:name=".HomeActivity"
            android:exported="false" />
        <activity
            android:name=".RegistrationActivity"
            android:exported="false" />
        <activity
            android:name=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>

Donsent work:委托工作:

    <application
        tools:replace="android:label"
        android:label="project"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher">

Bro Icannot initialize TuyaHomeSDK can guide what is the issue as Iam not using flutter Bro Icannot initialize TuyaHomeSDK 可以指导我没有使用 flutter 是什么问题

我已经解决了从FlutterApplication而不是Application扩展的问题

暂无
暂无

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

相关问题 AndroidManifest.xml中的“属性缺少Android名称空间前缀” - “Attribute is missing the Android namespace prefix” in AndroidManifest.xml 如何更改AndroidManifest.xml文件名? - How to change AndroidManifest.xml file name? 带有多个应用程序标签的AndroidManifest.xml - AndroidManifest.xml with multiple application tags 未创建Android SDK Eclipse AndroidManifest.xml - Android SDK Eclipse AndroidManifest.xml not created AndroidManifest.xml 在 Android Studio 上不可编辑 - AndroidManifest.xml not editable on Android Studio android studio中的AndroidManifest.xml编码错误 - AndroidManifest.xml encodin error in android studio 更改 package 名称后如何更新 AndroidManifest.xml? - How do I update AndroidManifest.xml after changing package name? 在 AndroidManifest.xml 中添加 android:configChanges=“orientation|screenSize”后,横向布局没有改变 - Orientation Layout not changing for landscape after adding android:configChanges=“orientation|screenSize” in AndroidManifest.xml 错误:颤振 - 在 [com.google.android.gms:play-services-maps:18.0.2] AndroidManifest.xml:33:9-64 的元素包上缺少“包”键属性 - Error : Flutter - Missing 'package' key attribute on element package at [com.google.android.gms:play-services-maps:18.0.2] AndroidManifest.xml:33:9-64 Android设备管理AndroidManifest.xml,为什么在接收方名称中出现问号? - Android Device Administration AndroidManifest.xml, why the question mark in the receiver name?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM