重命名整个项目 Android Studio
Rename full project Android Studio
我已经根据我自己和此处找到的所有内容重命名了一个项目,它可以工作,但只有一点点。
好像改名了,但是当你在设备中查看应用信息,或者卸载它时,旧名称还在。
如何进行完整重命名?
旧名称是 WifiHome,我想将它重命名为 Wifi Sentinel。
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "org.grenderg.wifisentinel"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.+'
compile 'com.android.support:gridlayout-v7:22.0.0'
compile 'com.android.support:palette-v7:22.0.0'
compile 'com.android.support:recyclerview-v7:22.0.0'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'com.android.support:support-v4:22.0.0'
}
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.grenderg.wifisentinel" >
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/icon"
android:label="@string/appName"
android:theme="@style/WifiSentinel">
<activity
android:name="org.grenderg.wifisentinel.activities.BaseActivity"
android:label="@string/appName"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="org.grenderg.wifisentinel.services.WifiScanService"
android:enabled="true"
android:exported="false" >
</service>
</application>
</manifest>
appName = Wifi 哨兵
所有地方都重命名了,但这里的信息没有:
您的应用程序文件夹中有一个 build.gradle 文件。您必须更改其中的 applicationId,也可以从 AndroidManifest 文件中修改它。然后将您的项目与 gradle 同步,清理并重建它。
- 右键单击您的根项目目录
- Select 重构 -> 重命名
- Select 重命名项目并在那里更改名称。
- 同时 Select 重命名模块并在那里进行更改。如果您收到一条消息说模块名称已更改,那很好。
- 现在再次右键单击项目根文件夹并select打开模块设置。
- 在“模块”部分下,删除与您的旧项目名称关联的所有文件夹。
- 应用设置并点击确定。并重新启动 Android Studio。
这似乎是以前安装过旧名称的应用程序的设备中的错误,我尝试在从未安装过该应用程序的设备上安装并且名称显示正确。
在其他人建议重构重命名和 gradle 文件编辑之后:
- 在 Android Studio 中转到顶部栏:
文件 => 设置 => 构建、执行、部署 => 构建工具 => Gradle
现在您必须取消选中 "offline work"。
在您的计算机上启用网络。
清理您的项目(构建 => 清理项目)+运行。
看到重命名 app_name/label 一切正常后,再次检查 "offline work"
(这些是在 android studio 1.2.2 上制作的)
我也有这个问题,没有错误,但安装的 apk 有旧名称,但是在测试游戏时我注意到操作栏上的旧名称,这给了我答案的线索,
转到您的资源文件夹,然后转到值文件夹,然后打开 strings.xml 文件。在这里你应该看到这样的东西:
<resources>
<string name="app_name">Rhg Timecard</string>
将此名称(在我的例子中是 Rhg Timecard)更改为您的新名称。
你现在应该都准备好了。
在 android 工作室中转到
res>values>string.xml 并在那里更改应用程序。
我已经根据我自己和此处找到的所有内容重命名了一个项目,它可以工作,但只有一点点。
好像改名了,但是当你在设备中查看应用信息,或者卸载它时,旧名称还在。
如何进行完整重命名?
旧名称是 WifiHome,我想将它重命名为 Wifi Sentinel。
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "org.grenderg.wifisentinel"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.+'
compile 'com.android.support:gridlayout-v7:22.0.0'
compile 'com.android.support:palette-v7:22.0.0'
compile 'com.android.support:recyclerview-v7:22.0.0'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'com.android.support:support-v4:22.0.0'
}
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.grenderg.wifisentinel" >
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/icon"
android:label="@string/appName"
android:theme="@style/WifiSentinel">
<activity
android:name="org.grenderg.wifisentinel.activities.BaseActivity"
android:label="@string/appName"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="org.grenderg.wifisentinel.services.WifiScanService"
android:enabled="true"
android:exported="false" >
</service>
</application>
</manifest>
appName = Wifi 哨兵
所有地方都重命名了,但这里的信息没有:
您的应用程序文件夹中有一个 build.gradle 文件。您必须更改其中的 applicationId,也可以从 AndroidManifest 文件中修改它。然后将您的项目与 gradle 同步,清理并重建它。
- 右键单击您的根项目目录
- Select 重构 -> 重命名
- Select 重命名项目并在那里更改名称。
- 同时 Select 重命名模块并在那里进行更改。如果您收到一条消息说模块名称已更改,那很好。
- 现在再次右键单击项目根文件夹并select打开模块设置。
- 在“模块”部分下,删除与您的旧项目名称关联的所有文件夹。
- 应用设置并点击确定。并重新启动 Android Studio。
这似乎是以前安装过旧名称的应用程序的设备中的错误,我尝试在从未安装过该应用程序的设备上安装并且名称显示正确。
在其他人建议重构重命名和 gradle 文件编辑之后:
- 在 Android Studio 中转到顶部栏: 文件 => 设置 => 构建、执行、部署 => 构建工具 => Gradle
现在您必须取消选中 "offline work"。
在您的计算机上启用网络。
清理您的项目(构建 => 清理项目)+运行。 看到重命名 app_name/label 一切正常后,再次检查 "offline work" (这些是在 android studio 1.2.2 上制作的)
我也有这个问题,没有错误,但安装的 apk 有旧名称,但是在测试游戏时我注意到操作栏上的旧名称,这给了我答案的线索,
转到您的资源文件夹,然后转到值文件夹,然后打开 strings.xml 文件。在这里你应该看到这样的东西:
<resources>
<string name="app_name">Rhg Timecard</string>
将此名称(在我的例子中是 Rhg Timecard)更改为您的新名称。 你现在应该都准备好了。
在 android 工作室中转到 res>values>string.xml 并在那里更改应用程序。