[英]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.