【发布时间】:2018-03-13 12:10:21
【问题描述】:
我知道,通常你会告诉我检查日志(在崩溃之前,看看我是否遗漏了什么)。 .什么都没有,因为当我尝试开始一个新活动时,应用程序无论如何都会崩溃。唯一有效的两个活动是SplashScreen 和SignIn
为了找出问题所在,我做了一些简单的事情
public class SplashScreen extends AppCompatActivity{
private final static String TAG = SplashScreen.class.getSimpleName();
private final static int DELAY = 2000;
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);
startActivity(new Intent(this, Root.class));
finish();
}
和 Root.class
public class Root extends AppCompatActivity {
private final static String TAG = Root.class.getSimpleName();
private long backPressedTime = 0;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
Log.i(TAG, "onCreate");
super.onCreate(savedInstanceState);
Log.i(TAG, "super.onCreate");
setContentView(R.layout.trending);
Log.i(TAG, "setContentView");
}
所以我设置了一些日志,看起来我去了第二个日志。第三个setcontentView 没有显示在控制台中。这个问题更奇怪,因为无论我尝试开始什么课程,它都会发生相同的情况。
提及:
检查了日志,没有异常(警告
03-13 13:52:33.302 23233-23233/com.example.codkom.shirtex W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable ...在应用程序上工作了几天,并在我的个人设备上进行了测试(工作没有问题,即使现在也是如此),但在任何其他设备上都没有..
1234563 multidex 没问题(因为 API 21+ 自己处理 multidex)
我的项目中有 7 个活动,其中 3 个出现问题
我已经到了不知道还能做什么的地步。这就是为什么我带着这个问题来到这里的原因。
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/cl_"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.design.widget.AppBarLayout
android:background="@drawable/overlay"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
app:layout_scrollFlags="enterAlways|scroll"
app:navigationIcon="@drawable/ic_hamburger_menu">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/standard_15_dp"
android:id="@+id/fab_"
android:backgroundTint="@color/blue"
app:fabSize="normal"
android:src="@drawable/ic_plus"
app:layout_anchor="@id/content_frame"
app:layout_anchorGravity="center|bottom"
app:layout_behavior="com.example.codkom.shirtex.ScrollAwareFABBehavior"/>
</android.support.design.widget.CoordinatorLayout>
<!-- The navigation drawer -->
<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start">
<include layout="@layout/mainmenu_activity"/>
</android.support.design.widget.NavigationView>
在清单中
<application
android:name=".application.ShirTexApp"
android:allowBackup="true"
android:icon="@drawable/ic_app_logo"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat"
android:fullBackupContent="true">
<activity android:name=".activities.Root" android:theme="@style/Theme.AppCompat.Light.NoActionBar" android:windowSoftInputMode="adjustPan"/>
</application>
【问题讨论】:
-
从屏幕截图中可以看出,您是带着意图启动应用程序的。如果您通过点击设备上的应用图标“正常”启动它会发生什么?
-
问题是我没有更多与此相关的信息。但可以肯定它发生在
onCreate(),但不是每个活动类,只是其中一些。我在想可能是主题相关,但似乎没有找到崩溃活动之间的联系.. -
请不要在有文字的情况下发布图片。它使阅读和搜索文本段变得更加困难。
-
是一小段文字,我觉得不难查
-
你想发帖
R.layout.trending
标签: android process kill-process