应用程序启动时应用程序崩溃,错误为java.lang.RuntimeException:
我对设备galaxy s5和ImageButton(在其他设备上工作正常)有一些问题 在我的登录活动中,我有ImageButton,所以当我运行应用程序时,它会崩溃 Quistion updated:添加了logcat中的所有日志 下面是按钮的XML-从第53行开始应用程序启动时应用程序崩溃,错误为java.lang.RuntimeException:,java,android,Java,Android,我对设备galaxy s5和ImageButton(在其他设备上工作正常)有一些问题 在我的登录活动中,我有ImageButton,所以当我运行应用程序时,它会崩溃 Quistion updated:添加了logcat中的所有日志 下面是按钮的XML-从第53行开始 <ImageButton android:id="@+id/btnNext" android:layout_width="70dp" android:layout_height="70dp" a
<ImageButton
android:id="@+id/btnNext"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="150dp"
android:background="@null"
android:scaleType="fitCenter"
app:srcCompat="@drawable/next_button" />
设备信息:
Galaxy s5,android版本-6.0尝试使用
android:src
而不是app:srcCompat。在下一个按钮图像的集合中。;) 我想我已经发现了问题:
Caused by: android.content.res.Resources$NotFoundException:
Resource"com.enjoyapp.gettmarried:drawable/next_button" (7f06007e) is not a
Drawable (color or path): TypedValue{t=0x1/d=0x7f06007e a=-1 r=0x7f06007e}
请注意您的
next_按钮
或将srcCompat
更改为src
或background
堆栈跟踪应该有更多内容,包括一个或多个“由”节,它们提供了有关出错原因的更多详细信息。HHi@commonware,我更新了代码,因为某些原因,设备不喜欢您的next\u按钮
drawable资源。有什么不寻常的地方吗?@commonware我尝试将图像更改为另一个图像,仍然是相同的错误您的“下一个按钮”可绘制资源有问题,请确保它存在于路径“可绘制/下一个按钮”下,并且您能显示“下一个按钮”资源的代码吗?
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.enjoyapp.gettmarried"
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
Caused by: android.content.res.Resources$NotFoundException:
Resource"com.enjoyapp.gettmarried:drawable/next_button" (7f06007e) is not a
Drawable (color or path): TypedValue{t=0x1/d=0x7f06007e a=-1 r=0x7f06007e}