HbuilderX 用android studio 本地打包app

本文详细介绍了如何使用Android Studio创建并配置MUI项目,包括本地资源包生成、SDK集成、build.gradle修改、AndroidManifest.xml设置及资源文件拷贝等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

新建MUI项目
在这里插入图片描述
生成本地资源包

android studio新建No acticity项目
在这里插入图片描述
切换至project模式
在这里插入图片描述
把下载的SDK文件中的libs目录下的 lib.5plus.base-release.aar 文件拷贝到项目下的的libs目录下
在这里插入图片描述
修改build.gradle文件,在dependencies 下新增依赖 implementation fileTree(dir: ‘libs’, include: [’*.aar’])

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.start"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation fileTree(dir: 'libs', include: ['*.aar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

在AndroidMainfest.xml中的application标签中两个activity标签,内容如下

<activity
 android:name="io.dcloud.PandoraEntry"
    android:configChanges="orientation|keyboardHidden|keyboard|navigation"
    android:label="@string/app_name"
    android:launchMode="singleTask"
    android:hardwareAccelerated="true"
    android:theme="@style/TranslucentTheme"
    android:screenOrientation="user"
    android:windowSoftInputMode="adjustResize" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

<activity
    android:name="io.dcloud.PandoraEntryActivity"
    android:launchMode="singleTask"
    android:configChanges="orientation|keyboardHidden|screenSize|mcc|mnc|fontScale|keyboard"
    android:hardwareAccelerated="true"
    android:permission="com.miui.securitycenter.permission.AppPermissionsEditor"
    android:screenOrientation="user"
    android:theme="@style/DCloudTheme"
    android:windowSoftInputMode="adjustResize">

    <intent-filter>

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

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

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

        <data
            android:scheme="h56131bcf" />
    </intent-filter>
</activity>

在src/main下新建文件夹assets与java文件夹同级,将SDK下的assets下data目录拷贝至src/main/assets目录下
在assets下新建apps目录,然后将HbuilderX生成的打包文件拷贝至apps目录下
assets下的目录结构必须是apps/APPID/www/,并且修改data/dcloud_control.xml的appid的值,保持和包名字一致
在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值