【问题标题】:problems with github projectgithub项目的问题
【发布时间】:2015-10-28 21:14:04
【问题描述】:

我正在使用this Github 项目。我正在尝试使用它提供的相对布局,但遇到了渲染错误

"以下类无法实例化: - com.software.shell.fab.ActionButton(打开类,显示异常,清除缓存)”

提示:在自定义视图中使用 View.isInEditMode() 跳过代码或在 IDE 异常详细信息中显示示例数据 java.lang.VerifyError: Expecting a stackmap frame at branch target 12 异常详细信息:位置:com/ software/shell/fab/ActionButton.isHidden()Z @5:if_icmpne 原因:此位置的预期堆栈图帧。字节码:0x0000000: 2ab6 022b 07a0 0007 04a7 0004 03ac 位于 java.lang.Class.getDeclaredConstructors0(Class.java:-2) 位于 java.lang.Class.privateGetDeclaredConstructors(Class.java:2658) 位于 java.lang.Class.getConstructor0 (Class.java:3062) 在 java.lang.Class.getConstructor(Class.java:1812) 在 android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:756) 在 android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java: 64) 在 android.view.LayoutInflater.rInflate(LayoutInflater.java:728) 在 android.view.LayoutInflater.inflate(LayoutInflater.java:492) 在 android.view.LayoutInflater.inflate(LayoutInflater.java:373) 将堆栈复制到剪贴板

我还提供了我的 xml 布局和构建 gradle 文件,以防我做错了什么。感谢您的帮助。

xml 布局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/theLayout"
   
    android:background="#0c2d34"
    xmlns:fab="http://schemas.android.com/apk/res-auto">

    <ListView
        android:layout_width="360dp"
        android:layout_height="430dp"
        android:id="@+id/listView"
        android:divider="@android:color/transparent"
        android:dividerHeight="10dp"
        android:scrollbars="none"
        android:layoutAnimation = "@anim/my_layout_animation"

        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true" />

    <ImageButton
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/imageButton"
        android:layout_below="@+id/listView"

        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:background="@drawable/timerbutton"

        android:onClick="goToFillOut"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/no_available_alarms"
        android:id="@+id/emptyTextViewForList"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:textAlignment="center"
        android:textSize="18sp"/>

    <com.software.shell.fab.ActionButton
        android:id="@+id/action_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_marginRight="@dimen/fab_margin"
        android:layout_marginBottom="@dimen/fab_margin"
        />


</RelativeLayout>

构建等级

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "21.1.2"

    defaultConfig {
       
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.github.shell-software:fab:1.1.2'
}

fab build.gradle

android {

    compileSdkVersion 22
    buildToolsVersion "21.1.2"

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
        }
    }

}

dependencies {
    compile 'org.slf4j:slf4j-api:1.7.9'
    compile 'com.github.shell-software:viewmover:1.1.0'
    compile 'com.github.shell-software:uitools:1.1.0'
}

【问题讨论】:

  • 显示整个堆栈跟踪
  • 好的,我相信我添加了它

标签: android github android-studio android-gradle-plugin


【解决方案1】:

堆栈跟踪表明它不是来自您正在运行的应用程序,而是来自您的 IDE 的可视化设计器。某些小部件在可视化设计器中可能无法工作(不会显示),因此如果出现这种情况,您可以填写错误报告。

【讨论】:

    猜你喜欢
    • 2019-12-07
    • 1970-01-01
    • 1970-01-01
    • 2020-02-12
    • 2022-01-15
    • 2019-04-30
    • 1970-01-01
    • 1970-01-01
    • 2022-08-16
    相关资源
    最近更新 更多