启动时崩溃

时间:2015-11-09 02:23:56

标签: java android xml

应用程序在启动后立即崩溃,错误:

11-08 21:13:08.704 15973-15973/com.t99sdevelopment.centralized E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.t99sdevelopment.centralized/com.t99sdevelopment.centralized.HomeScreen}: android.view.InflateException: Binary XML file line #81: Error inflating class android.support.design.widget.NavigationView

java文件:

package com.t99sdevelopment.centralized;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;
import android.widget.Toolbar;



public class HomeScreen extends AppCompatActivity {



   Intent intentHome = new Intent(this, HomeScreen.class);
   Intent intentAnnouncements = new Intent(this, AnnouncementsScreen.class);
   /*
   Intent intentSchedule = new Intent(this, ScheduleScreen.class);
   Intent intentCalendar = new Intent(this, CalendarScreen.class);
   Intent intentContactBook = new Intent(this, ContactBookScreen.class);
   Intent intentSportsSchedule = new Intent(this, SportsScheduleScreen.class);
   Intent intentFrontAndCentral = new Intent(this, FrontAndCentralScreen.class);
   Intent intentMap = new Intent(this, MapScreen.class);
   Intent intentAccount = new Intent(this, AccountScreen.class);
   */



   @Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_homescreen);
       setTheme(R.style.AppTheme);
   }



   private void goToHome(){



   }
   private void goToAnnouncements(){
       startActivity(intentAnnouncements);
   }



   private void goToSchedule(){



   }



   private void goToCalendar(){



   }



   private void goToContactBook(){



   }



   private void goToSportsSchedule(){



   }



   private void goToFrontAndCentral(){



   }



   private void goToMap(){



   }



   private void goToAccount(){



   }
}

Here's the gist of the other files.

此错误表示无法创建导航抽屉,但导航抽屉 的最后一次工作之间,现在,我没有更改任何似乎会影响它的内容。

我查看了代码,更改了一些内容,错误保持不变,但代码却不同,因此我提交了另一个新页面here,该页面已解决。

2 个答案:

答案 0 :(得分:0)

如果您确实没有尝试清除和构建项目或将代码复制到新的prpject

答案 1 :(得分:0)

设计库和Proguard的版本23.1.0存在问题。作为解决方法,您应该添加

-keep class android.support.v7.widget.LinearLayoutManager { *; } 

到你的proguard-rules.pro。

查看此问题:NavigationView InflateException