gpt4 book ai didi

java - 每当我尝试在模拟器中运行代码时,它都会显示应用程序不断停止,并且出现错误,我进入 setcontentview(R.layout.Main_activity)

转载 作者:行者123 更新时间:2023-12-02 02:01:47 26 4
gpt4 key购买 nike

public class MainActivity extends AppCompatActivity {

Button btnSignIn,btnSignUp;
TextView txtSlogan;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnSignIn = (Button)findViewById(R.id.btnSignIn);
btnSignUp = (Button)findViewById(R.id.btnSignUp);

txtSlogan = (TextView)findViewById(R.id.txtSlogan);
Typeface face = Typeface.createFromAsset(getAssets(),"fonts/NABILA.TTF");
txtSlogan.setTypeface(face);

btnSignIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

}
});
btnSignUp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

}
});

btnSignIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent signIn = new Intent(MainActivity.this,SignIn.class);
startActivity(signIn);

错误信息如下

08-04 21:02:59.089 12196-12196/? E/AndroidRuntime:     at info.hoang8f.widget.FButton.parseAttrs(FButton.java:116)
at info.hoang8f.widget.FButton.<init>(FButton.java:52)
... 30 more
2019-08-04 21:03:01.319 1886-5478/? E/UsageStatsDatabase: Unexpected event timestamp 945328593 loaded (beginTime : 1564916017123, endTime : 1564932059648)
Error found in:
/data/system/usagestats/0/daily/1564916017123
Please go to b/115429334 to help root cause this issue
2019-08-04 21:03:01.319 1886-5478/? E/UsageStatsService: Recent UsageStats missing! timeRange : 1564932779181, 1564932781315
Last reported Usage Event time : 1564932779181
Last in memory event time : 1564932779181
Last save time: 1564932063000
Last on disk event time : 1564932059648
2019-08-04 21:03:02.558 1886-1906/? E/memtrack: Couldn't load memtrack module
2019-08-04 21:03:02.594 12241-12241/? E/com.bnb.quicke: Unknown bits set in runtime_flags: 0x8000
2019-08-04 21:03:02.932 1682-1682/? E/libprocessgroup: set_timerslack_ns write failed: No such process
2019-08-04 21:03:03.056 1683-1866/? E/SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
2019-08-04 21:03:03.060 12241-12271/? E/vndksupport: Could not load /vendor/lib/egl/libGLES_emulation.so from sphal namespace: dlopen failed: library "/vendor/lib/egl/libGLES_emulation.so" not found.
2019-08-04 21:03:03.061 12241-12271/? E/libEGL: load_driver(/vendor/lib/egl/libGLES_emulation.so): unknown
2019-08-04 21:03:03.271 12241-12241/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.bnb.quicker, PID: 12241
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.bnb.quicker/com.bnb.quicker.MainActivity}: android.view.InflateException: Binary XML file line #40 in com.bnb.quicker:layout/activity_main: Binary XML file line #40 in com.bnb.quicker:layout/activity_main: Error inflating class info.hoang8f.widget.FButton
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3121)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3257)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:81)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1935)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7116)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:925)
Caused by: android.view.InflateException: Binary XML file line #40 in com.bnb.quicker:layout/activity_main: Binary XML file line #40 in com.bnb.quicker:layout/activity_main: Error inflating class info.hoang8f.widget.FButton
Caused by: android.view.InflateException: Binary XML file line #40 in com.bnb.quicker:layout/activity_main: Error inflating class info.hoang8f.widget.FButton
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:869)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1021)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:976)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1138)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1099)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1141)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1099)
at android.view.LayoutInflater.inflate(LayoutInflater.java:697)
at android.view.LayoutInflater.inflate(LayoutInflater.java:549)
at android.view.LayoutInflater.inflate(LayoutInflater.java:496)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.bnb.quicker.MainActivity.onCreate(MainActivity.java:20)
at android.app.Activity.performCreate(Activity.java:7698)
at android.app.Activity.performCreate(Activity.java:7687)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3096)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3257)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:81)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1935)

最佳答案

您从中获取FButton的库似乎是问题所在:

Error inflating class info.hoang8f.widget.FButton

有人已经在他的库中修复了它,只需使用 'com.github.jd-alexander:android-flat-button:v1.1' ( source ) 作为依赖项而不是目前使用的android平面按钮库。

您可以关注该项目的issue如果需要的话,获取更多信息。

关于java - 每当我尝试在模拟器中运行代码时,它都会显示应用程序不断停止,并且出现错误,我进入 setcontentview(R.layout.Main_activity),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57370754/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com