Can not extend android.content.ContentProvider
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- android
- Bereich
- mobile-dev
Rechercherichtung
Reproduziere den Absturz mit der verlinkten nativescript-content-provider-Demo und ihrer AndroidManifest.xml, ausgehend von der ContentProvider-Erweiterung und dem Stacktrace von Runtime.initInstance. Vergleiche das NativeScript-Verhalten mit dem funktionierenden reinen Android-Beispiel des Meldenden; abgeschlossen ist die Aufgabe, wenn die App ohne Absturz startet und die ContentProvider-Abfrage aufgerufen wird, um das Verzeichnis abzurufen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
- CLI:
- Cross-platform modules: 6.2.0
- Android Runtime: 6.2.0
- iOS Runtime (if applicable):
- Plugin(s):
Describe the bug
When starting app that has android.content.ContentProvider as in the simplest way I could find Android explodes with RuntimeException as below:
Process: org.nativescript.testprovider, PID: 8272
java.lang.RuntimeException: Unable to get provider com.tns.MyProvider: java.lang.NullPointerException: Attempt to read from field 'int com.tns.Runtime.currentObjectId' on a null object reference
at android.app.ActivityThread.installProvider(ActivityThread.java:6396)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5938)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5853)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.NullPointerException: Attempt to read from field 'int com.tns.Runtime.currentObjectId' on a null object reference
at com.tns.Runtime.initInstance(Runtime.java:788)
at com.tns.MyProvider.<init>(MyProvider.java:13)
at java.lang.Class.newInstance(Native Method)
at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:121)
at androidx.core.app.CoreComponentFactory.instantiateProvider(CoreComponentFactory.java:62)
at android.app.ActivityThread.installProvider(ActivityThread.java:6380)
... 10 more
To Reproduce
Extend android.content.ContentProvider with any content and try to start the app.
Expected behavior
- App does not crash
- Content provider query is being called to get the directory
Sample project
Demo project based on "Plain JavaScript -Hello World" template
Additional context
I managed to have it working using pure Android without problems and I copied the fragments of AndroidManifest.xml from it.
- Vorherrschende Sprache
- C++
- Sterne
- 563
- Forks
- 144
- Ø Merge
- 10 Std. 46 Min.
- Gemergte PRs (30 T.)
- 14
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus NativeScript/android
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 38/100
NativeScript/android#2039 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
NativeScript/android#2024 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 20/100
NativeScript/android#2020 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 42/100
NativeScript/android#2019 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
NativeScript/android#1986 ·
Alle Issues in NativeScript/android
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
duckdb/duckdb-wasm#2258 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
objectionary/eo-graphs#75 ·
-
Coarray integration tests carry no LABELS, so run_tests.py silently skips them under every backend Offencoarray
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
FISCO-BCOS/FISCO-BCOS#5642 ·