just-ai / aimybox-android-assistant

Embeddable custom voice assistant for Android applications
https://aimybox.com
Apache License 2.0
226 stars 52 forks source link

InflateException #58

Closed krauzee closed 3 years ago

krauzee commented 3 years ago

When I click on mic button my app is crashing with error: InflateException

: Binary XML file line #2: Binary XML file line #2: You must supply a layout_width attribute. Caused by: java.lang.UnsupportedOperationException: Bin ary XML file line #2: You must supply a layout_width attribute.

image

krauzee commented 3 years ago

Full stacktrace:

android.view.InflateException: Binary XML file line #2: Binary XML file line #2: You must supply a layout_width attribute. Caused by: java.lang.UnsupportedOperationException: Binary XML file line #2: You must supply a layout_width attribute. at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:767) at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:7036) at android.view.ViewGroup$MarginLayoutParams.(ViewGroup.java:7218) at androidx.recyclerview.widget.RecyclerView$LayoutParams.(RecyclerView.java:11905) at androidx.recyclerview.widget.RecyclerView$LayoutManager.generateLayoutParams(RecyclerView.java:8591) at androidx.recyclerview.widget.RecyclerView.generateLayoutParams(RecyclerView.java:4611) at android.view.LayoutInflater.inflate(LayoutInflater.java:509) at android.view.LayoutInflater.inflate(LayoutInflater.java:430) at com.justai.aimybox.components.extensions.ViewKt.inflate(View.kt:22) at com.justai.aimybox.components.extensions.ViewKt.inflate$default(View.kt:21) at com.justai.aimybox.components.adapter.ResponseDelegate.createViewHolder(ResponseDelegate.kt:15) at com.justai.aimybox.components.adapter.ResponseDelegate.createViewHolder(ResponseDelegate.kt:11) at com.justai.aimybox.components.base.DelegatedAdapter.onCreateViewHolder(DelegatedAdapter.kt:37) at com.justai.aimybox.components.base.DelegatedAdapter.onCreateViewHolder(DelegatedAdapter.kt:8) at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:7216) at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6347) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6231) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6227) at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2330) at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1631) at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1591) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:668) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4230) at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3941) at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4499) at android.view.View.layout(View.java:17666) at android.view.ViewGroup.layout(ViewGroup.java:5577) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at com.justai.aimybox.components.view.AimyboxButton.onLayout(AimyboxButton.kt:367) at android.view.View.layout(View.java:17666) at android.view.ViewGroup.layout(ViewGroup.java:5577) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:17666) at android.view.ViewGroup.layout(ViewGroup.java:5577) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:17666) at android.view.ViewGroup.layout(ViewGroup.java:5577) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:17666) at android.view.ViewGroup.layout(ViewGroup.java:5577) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:17666) at android.view.ViewGroup.layout(ViewGroup.java:5577) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741) 2020-11-02 13:30:09.558 1383-1383/ru.akbarslife.akbars E/AndroidRuntime: at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585) at android.widget.LinearLayout.onLayout(LinearLayout.java:1494) at android.view.View.layout(View.java:17666) at android.view.ViewGroup.layout(ViewGroup.java:5577) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:17666) at android.view.ViewGroup.layout(ViewGroup.java:5577) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585) at android.widget.LinearLayout.onLayout(LinearLayout.java:1494) at android.view.View.layout(View.java:17666) at android.view.ViewGroup.layout(ViewGroup.java:5577) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at com.android.internal.policy.DecorView.onLayout(DecorView.java:730) at android.view.View.layout(View.java:17666) at android.view.ViewGroup.layout(ViewGroup.java:5577) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2390) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2112) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1298) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6437) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:876) at android.view.Choreographer.doCallbacks(Choreographer.java:688) at android.view.Choreographer.doFrame(Choreographer.java:623) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:862) at android.os.Handler.handleCallback(Handler.java:754) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:163) at android.app.ActivityThread.main(ActivityThread.java:6238) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)

my build.gradle:

android { compileSdkVersion 29 buildToolsVersion "29.0.3"

defaultConfig {
    applicationId "myapp"
    minSdkVersion 23
    targetSdkVersion 29
    versionCode 2
    versionName "1.0.12"
    multiDexEnabled true

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        debuggable(false)
    }
    debug {
        minifyEnabled false
    }
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
    jvmTarget = "1.8"
}

packagingOptions {
    exclude("META-INF/*.kotlin_module")
}

}

dependencies {

//Aimylogic integration implementation("com.justai.aimybox:google-platform-speechkit:0.14.0") implementation("com.justai.aimybox:core:0.14.0") implementation("com.justai.aimybox:components:0.1.9") }

In the app and activity class, I did everything exactly according to the instructions.

morfeusys commented 3 years ago

Please provide your Android version

krauzee commented 3 years ago

Please provide your Android version

MIUI 11.0.2 Android 7.1.2

Neerav006 commented 3 years ago

Just put these styles in theme.xml file it should work

<style name="CustomAssistantButtonTheme" parent="DefaultAssistantTheme.AssistantButton">

    <!-- Customize Assistant button theme here -->

    <!-- <item name="aimybox_backgroundColor">@color/primary</item> -->
    <!-- <item name="aimybox_recordingAnimationColor">@color/recording</item> -->
    <!-- <item name="aimybox_buttonExpandedColor">@color/white</item> -->
</style>

<style name="CustomRecognitionWidgetTheme" parent="DefaultAssistantTheme.Widget.Recognition">

</style>

<style name="CustomResponseWidgetTheme" parent="DefaultAssistantTheme.Widget.Response">

</style>

<style name="CustomButtonReplyWidgetTheme" parent="DefaultAssistantTheme.Widget.ButtonReply">

</style>

<style name="CustomImageReplyWidgetTheme" parent="DefaultAssistantTheme.Widget.ImageReply">

</style>
krauzee commented 3 years ago

I added this to my styles.xml image

but I still get the error. What am I doing wrong? image

Billthebest1 commented 3 years ago

youre in better shape than me im compleatly new to this have android studio and dont have a clue on how to get a assisstant app to work lol ive tryied them all this one seems the closest to the one i had but google got rid of it even works with dialogue flo but i cant get it to work im missing something in the instructions on how to do it and every time i try i end up downloading more and more software it went from android studio to github desktop to some thing that starts with z i cant think of the name atm i just want a assisstant app like the one i paid for the one by speaktoit that one was perfect it was eficiant ran everything so useful af plus customizable and funny and its like im going to have to take 8 years of college in order to get it back

morfeusys commented 3 years ago

@krauzee are you sure you've applied this style in your AndroidManifest?

krauzee commented 3 years ago

I solved this problem, thanks

morfeusys commented 3 years ago

@krauzee did my suggest help you or you've found another solution?

krauzee commented 3 years ago

@krauzee did my suggest help you or you've found another solution?

your suggestion helped me, thanks!