当前位置: 首页 > news >正文

aab转apk

一、 android34升级:
1、升级到安卓34(蓝牙、图片)

再蓝牙广播的地方加入Context.RECEIVER_EXPORTED

2、废弃了 BluetoothAdapter#enable() 和 BluetoothAdapter#disable(),需要修改

// 以前的蓝牙操作BluetoothManager bluetoothManager = (BluetoothManager) this.getSystemService(Context.BLUETOOTH_SERVICE);BluetoothAdapter bluetoothAdapter = bluetoothManager.getAdapter();Log.i(TAG, "BluetoothAdapter isEnabled: " + bluetoothAdapter.isEnabled());if (!bluetoothAdapter.isEnabled()) {boolean enable = bluetoothAdapter.enable();Log.i(TAG, "BluetoothAdapter enable result: " + enable);
}
// 现在需要这样BluetoothManager bluetoothManager = (BluetoothManager) this.getSystemService(Context.BLUETOOTH_SERVICE);BluetoothAdapter bluetoothAdapter = bluetoothManager.getAdapter();Log.i(TAG, "BluetoothAdapter isEnabled: " + bluetoothAdapter.isEnabled());if (!bluetoothAdapter.isEnabled()) {ActivityResultLauncher<Intent> register = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),new ActivityResultCallback<ActivityResult>() {@Overridepublic void onActivityResult(ActivityResult result) {if (result == null) {Log.i(TAG, "开启蓝牙失败:result 为 null");return;}int resultCode = result.getResultCode();if (resultCode != Activity.RESULT_OK) {Log.i(TAG, "开启蓝牙失败:resultCode 为 " + resultCode);return;}Log.i(TAG, "开启蓝牙成功:resultCode 为 " + resultCode);}});Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);register.launch(intent);
}

图片-头像-拍照:
androidmainfest 增加权限:      Manifest.permission.READ_MEDIA_IMAGES,
                        Manifest.permission.READ_MEDIA_VIDEO,
                        Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED,
                        

代码中动态请求:
                        Manifest.permission.READ_MEDIA_IMAGES,
                        Manifest.permission.READ_MEDIA_VIDEO,
                        Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED,

 

请求权限参考代码

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU&& (ContextCompat.checkSelfPermission(this, READ_MEDIA_IMAGES) == PERMISSION_GRANTED|| ContextCompat.checkSelfPermission(this, READ_MEDIA_VIDEO) == PERMISSION_GRANTED)) {// Android 13及以上完整照片和视频访问权限} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE &&ContextCompat.checkSelfPermission(this, READ_MEDIA_VISUAL_USER_SELECTED) == PERMISSION_GRANTED) {// Android 14及以上部分照片和视频访问权限} else if (ContextCompat.checkSelfPermission(this, READ_EXTERNAL_STORAGE) == PERMISSION_GRANTED) {// Android 12及以下完整本地读写访问权限} else {// 无本地读写访问权限}

                        


======================================================================================
打aab包:
1、将项目中的\app\src\main\assets中的bin文件夹全部移动到base_assets文件夹
2、打包aab:build->Android App Bundle->选择签名,得到aab的包

===============================================
直接AS运行到手机上测试的:
1、需要将base_assets中的\base_assets\src\main\assets的bin文件,拷贝到\app\src\main\assets
2、移除base_assets文件夹

================================================

将aab转换为apks
1、将aab的包拷贝到AAB_TO_APK文件夹(名称默认为app-release.aab),
2、点击click.bat,出来小黑屏,等待apks的生成 (如果无响应的,重新下载bundletool-all-1.18.1的版本、检查jdk的版本)

下载链接:https://github.com/google/bundletool/releases


3、得到出来aa.apks,解压获得apk的文件包
4、安装到手机测试功能

http://www.dtcms.com/a/168823.html

相关文章:

  • 【Linux系统】进程间信号(捕捉信号)
  • 6.11.各顶点间的最短路径问题-Floyd算法
  • Redis基本使用
  • Git 基本操作(二)
  • AimRT从入门到精通 - 01实现一个helloworld
  • FHQ Treap
  • AI作画提示词:Prompts工程技巧与最佳实践
  • MYSQL-设计表
  • 消息队列的作用
  • [Verilog]跨时钟域数据传输解决方案
  • 2025五一数学建模竞赛A题完整分析论文(共45页)(含模型、可运行代码、数据)
  • spring中的@PostConstruct注解详解
  • 支持向量机(SVM)详解
  • 报文三次握手对么٩(๑^o^๑)۶
  • 网络原理 - 13(HTTP/HTTPS - 4 - HTTPS)
  • 从数据到故事:用可视化工具讲好商业“话本“
  • 鼎讯信通 智能通信干扰设备:多频段多模态信号压制解决方案
  • PS插件生态深度解析与精品合集推荐
  • 姜老师MBTI人格分析课程2:ENFP
  • ppt设计美化公司_杰青_长江学者_优青_青年长江学者_万人计划青年拔尖人才答辩ppt模板
  • 深入解析C++11 auto关键字:类型推导的现代实践
  • 【JS压缩图片】js压缩图片至指定大小
  • Flutter - 概览
  • 深入解析C++11委托构造函数:消除冗余初始化的利器
  • 【CVE-2025-1094】:PostgreSQL 14.15 SQL注入漏洞导致的RCE_ 利用代码和分析
  • AUTOSAR图解==>AUTOSAR_SRS_BusMirroring
  • 贝叶斯算法(Bayesian Algorithms)详解
  • WPF之ProgressBar控件详解
  • SPOJ 11576 TRIP2 - A Famous King’s Trip 【Tarjan+欧拉回路】
  • 【愚公系列】《Manus极简入门》011-习惯养成教练:“习惯塑造师”