I want to run the build of a create-react-app in Android's web-view. When I run a simple web app with JavaScript and CSS, it is running fine. But on trying to run a create-react-app I am ending up with an empty screen.
Here are the steps I followed:
I used the following command for create-react app:
npm install -g create-react-app
create-react-app my-app
I created the build file using:
npm run build
I copied and pasted the build folder into my Android project structure under assets directory. The build files in my Android Project Structure
My Main Activity code:
public class MainActivity extends AppCompatActivity {
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView view = (WebView) findViewById(R.id.web_view); WebSettings webSettings = view.getSettings(); webSettings.setJavaScriptEnabled(true); view.loadUrl("file:///android_asset/build/index.html"); }}
I am ending up with a blank screen on running the android app. What am I doing wrong?