. Advertisement .
..3..
. Advertisement .
..4..
The same as us, several of you could still encounter numerous errors while using your application. When we try to write data, we get “FATAL EXCEPTION: main Process java.lang.RuntimeException: Unable to start activity ComponentInfo“. It also is one of the most common errors that every programmer makes. So, what creates it, and how can it be fixed? We’ll come together to find a better method.
Why Did The Error “FATAL EXCEPTION: main Process java.lang.RuntimeException: Unable to start activity ComponentInfo” Occur?
In your task, you are using Firebase and attempting to write data toward the firebase database, but the real-time app database isn’t letting you. I’m having the following problem.
2021-08-06 22:57:51.467 8980-8980/? E/e.firebasefetc: Unknown bits set in runtime_flags:
0x8000
2021-08-06 22:57:52.207 8980-9018/com.example.upcApp E/Perf: Fail to get file list
com.example.upcApp
2021-08-06 22:57:52.208 8980-9018/com.example.upcApp E/Perf: getFolderSize() :
Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
2021-08-06 22:57:52.209 8980-9018/com.example.upcApp E/Perf: Fail to get file list
com.example.upcApp
2021-08-06 22:57:52.209 8980-9018/com.example.upcApp E/Perf: getFolderSize() :
Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
2021-08-06 22:57:52.553 8980-8980/com.example.upcApp E/AndroidRuntime: FATAL EXCEPTION:
main
Process: com.example.upcApp, PID: 8980
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.example.upcApp/com.example.upcApp.MainActivity}:
java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process
com.example.upcApp. Make sure to call FirebaseApp.initializeApp(Context) first.
The Top Solution To Fix This Error “FATAL EXCEPTION: main Process java.lang.RuntimeException: Unable to start activity ComponentInfo”?
Solution 1: Downgrade google-services to google-services: 4.3.8
The issue is that Google has cracked something in its Google-services: 4.3.9. So all you have to do is downgrade google-services to google-services: 4.3.8. Here’s how it’s done. You can change the following line in the build. gradle source code.
classpath 'com.google.gms:google-services:4.3.9'
And you need to change to this line.
classpath 'com.google.gms:google-services:4.3.8'
Solution 2: Import the library is as follows
Excepting the solution mentioned above, there is another solution for you to solve the error “FATAL EXCEPTION: main Process java.lang.RuntimeException: Unable to start activity ComponentInfo”.
To import an existing project into the library. The way you should use to import the library is as follows.
Right-click package explorer. Import, Expand Android, and Bring In Existing Android Code.
Choose the library for Google Play Services. In addition, select the workspace copy checkbox.
When you finish it, let’s reference the library project.
Place a right-click on the project. Go to the left pane and choose Android. A frame labeled “Library” would be visible at the bottom of the right pane. To add the imported library, click Add.
Right-click the project’s Androids Tools icon and select Add Support library from the menu.
You have to change the following code if you choose to use support libraries.
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment" />
To
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
Additionally, you must utilize SupportMapFragment in your Java program.
mMap = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
Conclusion
If you’re still stumped by the error “FATAL EXCEPTION: main Process java.lang.RuntimeException: Unable to start activity ComponentInfo” the solutions listed above are the quickest. When you still require help or have concerns, we have a thriving community where everyone is usually interested in helping. Finally, we sincerely wish for a day filled with new code remedies and appreciate your reading time.
Read more
→ Fix the error “FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed – JavaScript heap out of memory”
Leave a comment