3***@qq.com
3***@qq.com
  • 发布:2022-03-18 15:07
  • 更新:2022-03-21 11:46
  • 阅读:594

【报Bug】uni-push与UrlSchemes冲突导致安卓APP无法被H5拉起

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: windows11

HBuilderX类型: 正式

HBuilderX版本号: 3.3.13

手机系统: Android

手机系统版本号: Android 12

手机厂商: 小米

手机机型: 小米10

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

示例代码:

云打包错误的AndroidManifest.xml错误的地方,这样与引起URL Schemes 和 unipush冲突,导致无法通过H5拉起APP

            <intent-filter  
                >  
                <action  
                    android:name="android.intent.action.VIEW"  
                    >  
                </action>  
                <category  
                    android:name="android.intent.category.DEFAULT"  
                    >  
                </category>  
                <category  
                    android:name="android.intent.category.BROWSABLE"  
                    >  
                </category>  
                <data  
                    android:scheme="unipush"  
                    android:host="io.dcloud.unipush"  
                    android:path="/"  
                    >  
                </data>  
                <data  
                    android:scheme="xi5yjixke"  
                    >  
                </data>  
            </intent-filter>

改成这样就可以兼容URL Schemes 和 unipush了

<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="unipush"  
                    android:host="io.dcloud.unipush"  
                    android:path="/" />  
            </intent-filter>  
            <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="xi5yjixke" />  
            </intent-filter>

操作步骤:

在manifest.json中配置安卓UrlSchemes,并同时勾选uni-push功能,进行打包,无法通过<a href="test://abc">test:<a><br/>方式拉起APP

预期结果:

正常拉起App

实际结果:

安卓未拉起APP,IOS可以拉起APP

bug描述:

启用uni-push并云打包后,app无法被浏览器拉起;去除uni-push模块并重新云打包后,可以正常拉起;安卓不行,iOS正常

我的APPID

__UNI__0B9F1F0
2022-03-18 15:07 负责人:无 分享
已邀请:
FullStack

FullStack - 【插件开发】【专治疑难杂症】【ios上架、马甲包、白包、过审、已成功上架过几百个】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=22130】【非诚勿扰】QQ:543610866

修改应用配置

秋思

秋思

请问解决了吗?我的也是一直找不到问题,刚刚看到你的说去掉unipush打包确实可以了

DCloud_Android_THB

DCloud_Android_THB

请提供一下appid。

  • 3***@qq.com (作者)

    UNI0B9F1F0

    2022-03-21 11:42

  • DCloud_Android_THB

    回复 3***@qq.com: 你再打一次,时间长搜不到了。

    2022-03-21 11:46

  • 3***@qq.com (作者)

    回复 DCloud_Android_THB: 好了,已重新打包,appid:UNI0B9F1F0,你们可以看看我下面发的xml文件格式,我这边修改后是可以兼容的

    2022-03-21 11:52

  • 3***@qq.com (作者)

    回复 DCloud_Android_THB: 注意一下,appid的 UNI 前面有两个下划线,后面有两个下划线,这个编辑器默认显示为粗体了 UNI 0B9F1F0

    2022-03-21 14:50

  • h***@duochong.com

    需要反编译 apk 包,篡改打包文件,那这bug 是不是需要官方解决呢

    2022-03-21 14:59

  • h***@duochong.com

    还是可以回退到之前版本的HbuilderX 打包也行?

    2022-03-21 15:00

  • 3***@qq.com (作者)

    等官方解决吧,反编译只是应急一下,版本回退我测着不行

    2022-03-21 15:04

  • DCloud_Android_THB

    回复 3***@qq.com: 今天应该会更新打包机修正这个问题。

    2022-03-21 15:10

  • 3***@qq.com (作者)

    回复 DCloud_Android_THB: 好的,感谢,好了可以通知我一下,我们正好最近有这方面的业务可以测试

    2022-03-21 15:12

  • DCloud_Android_THB

    回复 3***@qq.com: ok

    2022-03-21 15:17

  • DCloud_Android_THB

    回复 3***@qq.com: 打包机已更新。

    2022-03-21 21:07

  • 3***@qq.com (作者)

    回复 DCloud_Android_THB: 好的

    2022-03-22 08:40

3***@qq.com

3***@qq.com (作者) - 一个写代码的普通人

同时启用UrlSchemes与uni-push,云打包后的AndroidManifest.xml为
<intent-filter

<action
android:name="android.intent.action.VIEW"

</action>
<category
android:name="android.intent.category.DEFAULT"

</category>
<category
android:name="android.intent.category.BROWSABLE"

</category>
<data
android:scheme="unipush"
android:host="io.dcloud.unipush"
android:path="/"

</data>
<data
android:scheme="xi5yjixke"

</data>
</intent-filter>
需要修改为
<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="unipush"  
                android:host="io.dcloud.unipush"  
                android:path="/" />  
        </intent-filter>  
        <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="xi5yjixke" />  
        </intent-filter>  

这样就能与unipush兼容了

  • h***@duochong.com

    麻烦问下 这个文件在哪,云打包后 直接不就是apk 了吗

    2022-03-21 14:52

  • 3***@qq.com (作者)

    回复 h***@duochong.com: 在APK包里,需要反编译篡改APK包才行

    2022-03-21 14:56

该问题目前已经被锁定, 无法添加新回复