Comments (7)
I confirmed this issue by checking the generated MainActivity
Class name here. It was returning the entire identifier which included the applicationIdSuffix
. (com.example.foo.beta
)
I have a fix which requires exposing the defaultConfig.applicationId
from the gradle file. Since I already had this value from react native config, I just had to look it up the applicationId
inside RNBootSplashActivity.java
and use that to create the Class name.
I thought I could use the BuildConfig.APPLICATION_ID
, however that value returns the id for the library bundle, not the root RN app. I ended up with a solution based on this SO post
app/build.gradle
def appId = "com.example.foo"
defaultConfig {
applicationId appId
...
resValue "string", "build_config_package", appId
}
RNBootSplashActivity.java
int resId = this.getResources().getIdentifier("build_config_package", "string", this.getPackageName());
Intent intent = new Intent(this, Class.forName(this.getString(resId) + ".MainActivity"));
I'm not sure this is the best/cleanest solution, since it requires an addition to the app/build.gradle
file. But it does fix this issue.
from react-native-bootsplash.
@andrewkslv #16 seems to fix the issue. I will make a new release with it today!
from react-native-bootsplash.
I'm seeing this same behavior. When I try to build for a specific environment/flavor, the splash screen will dismiss itself the first time after launched by the gradle task. However, when I manually launch the app the splash screen hangs and the js bundle never loads. I'm using an applicationIdSuffix
for dev & staging. Both of those have the issue however my production build which just uses the plain bundleId works fine & can be relaunched without hanging.
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
flavorDimensions "version"
productFlavors {
development {
dimension "version"
applicationIdSuffix ".dev"
}
staging {
dimension "version"
applicationIdSuffix ".beta"
}
production {
dimension "version"
}
}
from react-native-bootsplash.
@zoontek Is multiple environments something you would like to support in this library? I can add a PR with an updated example. It will add a couple more steps to the android process. The biggest change is that you can't fun react-native run-android
by itself anymore, you will have to pass the variant as well:
react-native run-android --variant=DevelopmentDebug
from react-native-bootsplash.
@shwanton Your issue seems related to #8 Will the meta-data solution be good enough?
What do you mean by supporting multiple environments? Displaying a different splash screen per env variant?
from react-native-bootsplash.
I bump into the same issue since I'm using applicationIdSuffix
for having multiple application instances at the same time on the phone.
from react-native-bootsplash.
Just tried that fork out and it works great!
Much better solution than the one I proposed.
Thank you much!
from react-native-bootsplash.
Related Issues (20)
- Bug when assembleeRelease HOT 1
- iOS error during debug scheme starting HOT 2
- How can i show code push progress bar in splash screen? HOT 1
- Output/Document need to manually create missing images HOT 1
- Default Android system splashscreen appears before my custom splashscreen HOT 1
- Add option to use system scheme instead of scheme returned by useColorScheme in useHideAnimation HOT 6
- 我在屏幕中间放一个logo,我还需要在屏幕底部放些文字,要怎么做呢?
- Add plugin for nx HOT 1
- splash icon disappeared in android HOT 3
- Adding android:windowBackground causes it to appear after original splash hides HOT 3
- Generated background has incorrect color HOT 6
- Generate splashscreen HOT 1
- iOS: building failed with RN 0.73 and new arch enabled HOT 3
- RN 0.74 - How to avoid `createRootViewWithBridge` HOT 1
- Small icon size on Samsung devices with Android 12 HOT 3
- Expo config plugin overrides AppDelegate imports from other plugins HOT 8
- circle in the center at the beginning of the splash screen display (android) HOT 1
- iOS crashes with react native 0.74 without new arch HOT 2
- Android app does not launch automatically in debug mode HOT 2
- No visible @interface for 'RNNAppDelegate' declares the selector 'createRootViewWithBridge:moduleName:initProps:' HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-bootsplash.