when i try to build my android project i get this errors
Error:(8, 37) error: package android.support.design.widget does not exist Error:(18, 9) error: cannot find symbol class TabLayout Error:(18, 32) error: cannot find symbol class TabLayout Error:(21, 33) error: cannot find symbol variable TabLayout Error:(27, 56) error: package TabLayout does not exist Error:(48, 36) error: cannot find symbol variable menu Error:(28, 57) error: package TabLayout does not exist Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details. Error:(55, 23) error: cannot find symbol variable action_settings
and this is my code
package com.chaos.creativo; import android.os.Bundle; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.support.design.widget.TabLayout; /** * Created by ahmed on 3/7/2016. */ public class Signin_up extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.signing_up); TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("SIGN IN")); tabLayout.addTab(tabLayout.newTab().setText("SIGN UP")); tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); final PageAdapter adapter = new PageAdapter(getSupportFragmentManager(), tabLayout.getTabCount()); viewPager.setAdapter(adapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Override public void onTabUnselected(TabLayout.Tab tab) { } @Override public void onTabReselected(TabLayout.Tab tab) { } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
my build.gradle
> apply plugin: 'com.android.application' > > android { > compileSdkVersion 23 > buildToolsVersion "23.0.2" > > defaultConfig { > applicationId "com.chaos.creativo" > minSdkVersion 18 > targetSdkVersion 23 > versionCode 1 > versionName "1.0" > } > buildTypes { > release { > minifyEnabled false > proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' > } > } } > > dependencies { > compile fileTree(dir: 'libs', include: ['*.jar']) > testCompile 'junit:junit:4.12' > compile 'com.android.support:appcompat-v7:23.1.1' > compile 'com.google.android.gms:play-services-ads:8.4.0' > compile 'com.google.android.gms:play-services-identity:8.4.0' > compile 'com.firebase:firebase-client-android:2.3.1' > compile 'com.google.android.gms:play-services-gcm:8.4.0' > compile 'com.android.support:support-v4:23.2' > compile 'com.android.support:design:23.2' }
If you are using android studio then put following in gradle file and rebuild.
compile 'com.android.support:support-v4:23.2.1' compile 'com.android.support:design:23.2.1'
If version 23.2.1 won't support, use 23.1.1
Replace
implementation 'com.android.support:support-v4:28.0.0'
with
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
in your build.gradle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With