hnu-digihealth / sensorframework-bluetooth-low-energy-client

Bluetooth Low Energy Capacitor Plugin
MIT License
20 stars 9 forks source link

Runtime error #7

Open sedonaguy opened 4 years ago

sedonaguy commented 4 years ago

Hi, I was just trying to integrate your capacitor plugin into an Ionic 5 Capacitor application. But, it dies in MainActivity with this error:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.modus.btle/com.modus.btle.MainActivity}: android.view.InflateException: Binary XML file line #2 in com.modus.btle:layout/bridge_layout_main: Binary XML file line #2 in com.modus.btle:layout/bridge_layout_main: Error inflating class android.support.design.widget.CoordinatorLayout

Any idea what the problem might be? The gradle build files seem correct...

Regards, Robert

sedonaguy commented 4 years ago

I was able to fix this by updating the plugin to use androidx libraries:

build.gradle:

dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(':capacitor-android') implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' }

bridge_layout_main.xml: <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.getcapacitor.BridgeActivity"

<WebView
    android:id="@+id/webview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />

</androidx.constraintlayout.widget.ConstraintLayout>