Blog
首页
文档
收藏
关于
  • 在线转换时间戳 (opens new window)
  • 在线压缩图片 (opens new window)
  • Float-Double转二进制 (opens new window)
  • 文件转Hex字符串 (opens new window)

HiuZing

🍑
首页
文档
收藏
关于
  • 在线转换时间戳 (opens new window)
  • 在线压缩图片 (opens new window)
  • Float-Double转二进制 (opens new window)
  • 文件转Hex字符串 (opens new window)
  • 前端面试题

  • JavaScript

  • Vue2

  • port

  • CSS

  • Node.js

  • JavaScript优化

  • uniapp

  • Mini Program

  • TypeScript

  • 面向对象编程

  • UI组件

  • Plugin

  • Vue3

  • 性能优化

  • Axios

  • 状态管理

  • React

  • Mock

  • Icon

  • Template

  • 构建工具

  • 项目规范配置

  • Taro

  • SVG

  • React Native

    • 沙盒环境-Expo

    • 原生环境

      • 案例

      • 文档

        • React Native搭建环境
        • React Native打包发布
        • React Native原生模块
        • React Native更改项目信息
          • App名称
          • 图标
          • 包名
          • 打包名称
        • React Native打包apk后无法进行网络请求
    • React Native第三方库
  • 前端
  • React Native
  • 原生环境
  • 文档
HiuZing
2023-11-07
目录

React Native更改项目信息

# App名称

在android/src/main/res/values/strings.xml中

<resources>
    <string name="app_name">app的名字</string>
</resources>
1
2
3

# 图标

  1. 打开图标工场 (opens new window)将图标上传

  2. 下载解压

  3. 替换图标

    1. 替换 ios/我的项目名称/Images.xcassets/AppIcon.appiconset 下的图标

    2. android/app/src/main/res 下对应的图标(debug也要修改)

      <application
          android:name=".MainApplication"
          android:label="@string/app_name"
          android:usesCleartextTraffic="true"
          android:icon="@mipmap/ic_launcher"
      -   android:roundIcon="@mipmap/ic_launcher_round"
          android:allowBackup="false"
          android:theme="@style/AppTheme">
          ....
        </application>
      
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10

# 包名

本次使用的是react-native-rename - npm (npmjs.com) (opens new window)

  1. 命令:

    npx react-native-rename@latest "new_name" -b "bundle_identifier"
    
    # 清空打包缓存(安卓)
    ./gradlew clean
    
    1
    2
    3
    4
  2. 将android/app/build.gradle中namespace和applicationId,更换新的包名

  3. 检查项目有没有漏的包名没有更换成功

    android/app/src/release/java/com/tropsx/ankleti18n/ReactNativeFlipper.java本次就该文件没有更换成功

  4. #重新编译项目
    
    #再次打包
    ./gradlew assembleRelease
    
    1
    2
    3
    4

# 打包名称

本次采取以时间戳命名

在android/app/build.gradle

android {
    ...
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def formattedDate = new Date().format('yyyyMMddHHmmss')
            output.outputFileName = "trops-${formattedDate}.apk"
        }
    }
    ...
}
1
2
3
4
5
6
7
8
9
10
上次更新: 2024/08/14, 04:14:33
React Native原生模块
React Native打包apk后无法进行网络请求

← React Native原生模块 React Native打包apk后无法进行网络请求→

最近更新
01
React Native 使用SVG
08-13
02
Docker基础命令
08-04
03
算数逻辑单元
07-30
更多文章>
Theme by Vdoing | Copyright © 2021-2024 WeiXiaojing | 友情链接
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式