React Native configuration for existing Android project - android

I'am trying to integrate React Native to my existing Android app using the newest React Native version of 0.45.1.
The project setup is standard as created by the init command. In the android subfolder I checked out my existing Android app and followed the steps from Integration With Existing Apps
When running react-native run-android its gets me:
ENOENT: no such file or directory, open 'app/src/main/AndroidManifest.xml'
This is obviously due to my non standard Android project structure as I have several modules and my main module is not named app.
Now the actual question: Is there a way to configure the React Native layer and to tell it where my Manifest and possibly other required files reside?

Got is, pretty simple actually. --help is your friend.
--appFolder [string] Specify a different application folder name for the android source.
is exactly what I was looking for. For anyone who has similar troubles, there are some other interesting options as well.

Related

Building native module to install via npm but unable to link android module

I'm working on creating an npm module for use in react native that uses native java/ objective c libraries and I'm running into some trouble with android.
I'm following the react native documentation for creating native modules here: https://reactnative.dev/docs/native-modules-setup
Those steps are straight forward and I'm able to get my native code in place, run npm pack in the root directory of the module, npm install /path/to/module/package-0.1.0.tgz in the root directory of my project, cd ios && pod install and have the native ios module linked, running fine and accessible via NativeModule.
I start running into problems on the android side because the module doesn't appear with the rest of the packages, as far as I know everything should auto link and I shouldnt need any custom setup but non the less I've tried adding include ':custom-package' to settings.gradle, and even adding packages.add(new CustomPackage()); to MainApplication.java but of course it's unable to resolve my CustomPackage. Is there something I'm missing? Seems odd that android isnt working considering I'm using the built in create-react-native-library command.
Well not sure what I did wrong the first few times when I tried the above process but I tried again from scratch using the create-react-native-library and it worked perfectly, android module got auto linked and life is good again.

Android and ios folders missing in react native app

I created a react native app using expo init and I choose the blank (Typescript) template. Now I want to extract an apk but in the documentation, there is something to configure which is in the android folder, but I don't have it. I tried to find something but nothing worked. I run: react-native upgrade , react-native link , react-native run-android(Android project not found. Are you sure this...).
Is there a solution to generate those folders? And if I create an app with minimal (Typescript) template, the folders are there but it's also native android(java) and ios projects, and I want to know why.
I have react: 16.13.1 and react-native: 0.63.2.
I know that I could re-create the app with minimal template, but I don't want to add these folders to git.

Is there a way to decompile an apk built through Expo and open the resulting project in Android Studio?

I've been building some apps in react native using expo and wanted to see how the code looks in java in Android studio. I'm having trouble using decompiler(I've tried jadx, decompileandroid.com, and CFR). When I open the folder in android studio I can't find any source files other than classes named a,b,c,etc that have maybe 10 lines of code. I can't even find the strings that were in my app.
Does expo build the apk with proguard enabled? If so, is there a way to disable it? I have the react native source, I just want to see the java analogue. Is this a problem solely from using expo?
If you want to use a project you created using "expo" in your Android studio, you need to separate expo.
To separate, run 'expo eject'. This will result in an android file and an iOS file.
this is link about expo eject
ExpoKit is an Objective-C and Java library that allows you to use the Expo platform and your existing Expo project as part of a larger standard native project -- one that you would normally create using Xcode, Android Studio, or react-native init.
You can use the new Android file to run the Android studio.

Convert React Native project to traditional android studio project

I recently started to learn react and want to know if, It is possible to convert a react-native project to a normal android project that could be continued and coded completely in Android Studio?
I know I can open android directory with android studio and do some changes at the current state (while react-native still need) but I want to completely remove any dependency of react-native and node module from continuing developing the application.
If no, (that I expect the answer be this!) please describe a little about reason. (If I be correct, in react-native, layouts are same as original android widgets, but I'm not sure about possibility of converting ES6 to Java.)

Load AOSP Application to Android Studio

I found a few questions asking how to get the source code from the AOSP running in Android Studio. However, I could not find any explanation on how to import only a single application of the AOSP.
I am trying to do it for the Dialer application which can be found here. However, I had only minor success, I was able to import the code as a project, but didn't manage to set up dependencies and required libraries and all that.
Can anybody tell me if it is possible, and if so, how this is done?
UPDATE:
It seems impossible to achieve this with the code that i found and which was part of the full android distribution of google. But google decided to distribute the Dialer application just like any other application via the playStore. So there should be a possibility to find this code, IF it is also running under the open source project.
You can only open the whole AOSP inside Android Studio.
After you finish building the source do make idegen && development/tools/idegen/idegen.sh inside your root folder and then open the new android.ipr in your root via Android Studio.
AOSP code you are looking is not Android Studio compatible, It's an Eclipse project.

Categories

Resources