1***@139.com
1***@139.com
  • 发布:2024-09-07 11:55
  • 更新:2024-09-08 12:20
  • 阅读:66

UTS插件使用的时候,报无法导入安卓包

分类:uni-app
关联插件: qd-wakeLock

导入的时候,为什么提示如下错误?有没有人帮忙解答一下。 jdk sdk gradle已经正确配置了

11:45:45.151 [plugin:vite:import-analysis] Failed to resolve import "android.content.Context" from "../../../../uniapp/lesson1/uni_modules/qd-wakeLock/index.uts". Does the file exist?
11:45:45.151 at uni_modules/qd-wakeLock/index.uts:1:20
11:45:45.151 1 | import Context from "android.content.Context";
11:45:45.151 | ^
11:45:45.151 2 | import { UTSAndroid } from "io.dclou

d.uts";
11:45:45.151 3 | import PowerManager from "android.os.PowerManager";


2024-09-07 11:55 负责人:无 分享
已邀请:
DCloud_Android_DQQ

DCloud_Android_DQQ

参考一下 hello uts : https://gitcode.net/dcloud/hello-uts

你可以先试一下你那边是否正常运行

1***@139.com

1***@139.com (作者)

hello-uts 的可以, 可以解析到包

1***@139.com

1***@139.com (作者)

项目目录下copy 了hello-uts的一个安卓配置文件(AndroidManifest.xml)过去,就可以解析了。 安卓配置文件如下,还不知道是哪里控制着, 慢慢研究

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="io.dcloud.hellouts">

<application android:networkSecurityConfig="@xml/custom_network_security_config"  

<!--meta-data-->
<meta-data android:name="TencentMapSDK" android:value="您申请的腾讯定位App Key" />
<!--需要替换成开发者自己的包名-->
<activity android:name="uni.UNI70BE9D0.RootPackageActivity"
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
<!--需要替换成开发者自己的包名-->
<action android:name="uni.UNI70BE9D0.RootPackageActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!--meta-data-->
<activity android:name="io.dcloud.uniapp.UniLaunchProxyActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="appuniappx"/>
</intent-filter>
</activity>
</application>
</manifest>

1***@139.com

1***@139.com (作者)

删掉这个配置文件,也可以解析了。 搞不清楚为啥。

要回复问题请先登录注册