Ricevo un errore quando eseguo il mio progetto. Stavo solo seguendo questo tutorial e l'ho usato nel mio progetto.ECCEZIONE FATALE: main java.lang.NoClassDefFoundError: android.support.v7.internal.widget.TintManager
il mio codice che è esattamente allo stesso modo nel tutorial
public class MainEventActivity extends AppCompatActivity {
private Toolbar toolbar;
private TabLayout tabLayout;
private ViewPager viewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_event_activity);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
viewPager = (ViewPager) findViewById(R.id.viewpager);
setupViewPager(viewPager);
tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
}
private void setupViewPager(ViewPager viewPager) {
ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
adapter.addFragment(new OneFragment(), "ONE");
adapter.addFragment(new TwoFragment(), "TWO");
adapter.addFragment(new ThreeFragment(), "THREE");
viewPager.setAdapter(adapter);
}
class ViewPagerAdapter extends FragmentPagerAdapter {
private final List<Fragment> mFragmentList = new ArrayList<>();
private final List<String> mFragmentTitleList = new ArrayList<>();
public ViewPagerAdapter(FragmentManager manager) {
super(manager);
}
@Override
public Fragment getItem(int position) {
return mFragmentList.get(position);
}
@Override
public int getCount() {
return mFragmentList.size();
}
public void addFragment(Fragment fragment, String title) {
mFragmentList.add(fragment);
mFragmentTitleList.add(title);
}
@Override
public CharSequence getPageTitle(int position) {
return mFragmentTitleList.get(position);
}
}
Im chiamando il MainEventActivity in questo modo:
btnNext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(MainActivity.this, MainEventActivity.class);
startActivity(i);
finish();
}
});
mio log di errore:
12-01 08:00:29.903 22530-22530/com.erlawkward.albarol.eventlocatorapp
E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: android.support.v7.internal.widget.TintManager
at android.support.design.widget.TabLayout$TabView.<init>(TabLayout.java:1145)
at android.support.design.widget.TabLayout.createTabView(TabLayout.java:635)
at android.support.design.widget.TabLayout.addTabView(TabLayout.java:669)
at android.support.design.widget.TabLayout.addTab(TabLayout.java:365)
at android.support.design.widget.TabLayout.addTab(TabLayout.java:340)
at android.support.design.widget.TabLayout.setTabsFromPagerAdapter(TabLayout.java:624)
at android.support.design.widget.TabLayout.setupWithViewPager(TabLayout.java:595)
at com.erlawkward.albarol.eventlocatorapp.activity.activity.MainEventActivity.onCreate(MainEventActivity.java:41)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
errore in questa linea:
tabLayout.setupWithViewPager(viewPager);
Hai chiamato 'compilare 'com.android.support: Design: 23.0.1'' –
@IntelliJAmiya sì signore, questo è il mio dependecies: compilazione 'com.android.support:appcompat-v7:23.1.1' compilazione 'com.android.support:support-v4:23.1.1' compilazione ' com.mcxiaoke.volley: library-aar: 1.0.0 ' compile 'com.android.support:design:23.0.1' – ErlAl
Sono ancora di fronte al problema, compilare 'com.android.support:support-v4:23.1.1' compilare 'com.android.support:appcompat- v7: 23.1.1 ' compile' com.android.support:design:23.0.1 ' –