我工作的公司希望从Tuya (一个IoT设备提供商)导入设备。Tuya为他们的客户提供了一个本地SDK来管理设备。我工作的公司有兴趣在一个颤振项目中使用这个SDK。
为了集成这个SDK,我需要使用Java/Kotlin和Objective/Swift在颤振项目中进行本机开发。Tuya提供了使用这些语言的指南。。不幸的是,我有一些复杂的情况,将本指南改编为颤振项目。我遇到的主要问题是SDK的初始化。在AndroidManifest.xml (project\android\app\src\main\AndroidManifest.xml)中,<application android:name=””>属性已经与${applicationName}一起使用。我需要修改它但我不知道该怎么做。
正常工作:
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>唐森德工作:
<application
tools:replace="android:label"
android:label="project"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">发布于 2022-06-30 14:56:26
我已经解决了从FlutterApplication扩展到Application的问题。
https://stackoverflow.com/questions/72789497
复制相似问题