赞
踩
- 1.打开这个文件“项目文件夹\app\build.gradle”,在文件的第二行加入以下代码:
-
- import org.json.JSONObject
- String currentDir = "${project.rootProject.projectDir}"
- File jsonFile = new File(currentDir + "/app/src/main/assets/a.json")
- FileInputStream fileInputStream = new FileInputStream(jsonFile)
- InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream)
- BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(jsonFile)))
- String content = ""
- String temp
- while ((temp = bufferedReader.readLine()) != null) {
- content += temp
- }
- fileInputStream.close()
- inputStreamReader.close()
- bufferedReader.close()
- JSONObject jsonObject = new JSONObject(content)
- String newPackageName = jsonObject.getString("applicationId ")
- android.defaultConfig.applicationId = newPackageName
-
- 2.把applicationId 'com.cc.com'这一行删掉。(修改结束)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。