Definition
APPLICATION_NAME
– this will be used by react-native to identify your application. APPLICATION_DISPLAY_NAME
– display name in Android Home Screen.ANDROID_PACKAGE_NAME
– A valid android package name.
Search package name whole project
AndroidManifest.xml
<!-- ./android/app/src/main/AndroidManifest.xml -->
<!-- change the value of 'package' -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ANDROID_PACKAGE_NAME">
</manifest>
BUCK
# ./android/app/BUCK
# find 'android_build_config' and 'android_resource'
# ANDROID_PACKAGE_NAME = com.mycompany.whaterver.app
android_build_config(
name = "build_config",
package = "ANDROID_PACKAGE_NAME",
)
android_resource(
name = "res",
package = "ANDROID_PACKAGE_NAME",
res = "src/main/res",
)
MainActivity.java
// ./android/app/src/main/java/
/* NOTE: create a directory according to your package name
* example: An android package name like, 'com.mycompany.sub.app'
* will turn into 'com/mycompany/sub/app'
* Now, manually create/put MainActivity.java under './android/app/src/main/java/com/mycompany/sub/app/'
*/
package ANDROID_PACKAGE_NAME;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "APPLICATION_NAME";
}
}
MainApplication.java
// ./android/app/src/main/java/
// Similar to MainActivity.java
/* NOTE: create a directory according to your package name
* example: An android package name like, 'com.mycompany.sub.app'
* will turn into 'com/mycompany/sub/app'
* Now, manually create/put MainActivity.java under './android/app/src/main/java/com/mycompany/sub/app/'
*/
package ANDROID_PACKAGE_NAME;
import android.app.Application;
import com.facebook.react.ReactApplication;
build.gradle
# ./android/app/build.gradle
# find 'applicationId' under 'android.defaultConfig'
# android.defaultConfig.applicationId
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "ANDROID_PACKAGE_NAME"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
Search application name whole project
settings.gradle
// ./android/settings.gradle
rootProject.name = 'APPLICATION_NAME'
include ':app'
index.js
import { AppRegistry } from 'react-native';
import App from './App';
AppRegistry.registerComponent('APPLICATION_NAME', () => App);
package.json
{
"name": "APPLICATION_NAME",
...
}
Search app display name whole project
strings.xml
<!-- ./android/app/src/main/res/values/strings.xml -->
<resources>
<!-- NOTE:
This will be the name visible in the Android Home screen
-->
<string name="app_name">APPLICATION_NAME/APPLICATION_DISPLAY_NAME</string>
</resources>
app.json
{
"name": "APPLICATION_NAME",
"displayName": "APPLICATION_DISPLAY_NAME"
}
markterence
Leave a Reply