How to disable errors like Eclipse when creating signed apks in Android Studio 1… here is a solution to the problem.
How to disable errors like Eclipse when creating signed apks in Android Studio 1
I have a problem with my class, but
when I run it on my phone using a cable connected to android studio, it works fine, but when I generate the signed apk, I get a class error like this
Error:Error: This fragment inner class should be static (app.browser.HomeActivity.MyWebBrowser) [ValidFragment]
I
can’t change the static class because this subclass context shows an error when I put static, so please help me with this, I want to disable this error when generating signed apk. Please anyone can suggest me.
My code:
public class HomeActivity extends FragmentActivity implements ActionBar.TabListener {
private ActionBar.Tab iTab;
static String TAB_TITLE="Untitle";
private ViewPager viewPager;
static TabsPageAdapter mAdapter;
static android.app.ActionBar actionBar;
Context context;
Button btNewtab,btCloseTab,btTabCount;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
context=HomeActivity.this;
objectReferences();
createDir();
actionBar =getActionBar();
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setHomeButtonEnabled(false);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.hide();
mAdapter = new TabsPageAdapter(getSupportFragmentManager());
viewPager.setAdapter(mAdapter);
viewPager.setOffscreenPageLimit(500);
viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener(){
@Override
public void onPageScrolled(int i, float v, int i2) {
}
@Override
public void onPageSelected(int i) {
mAdapter.notifyDataSetChanged();
PAGE_CURRENT=i;
System.out.println("CURRENT PAGE DISCRIPTION : "+PAGE_CURRENT);
}
@Override
public void onPageScrollStateChanged(int i) {
}
});
}
_________________TABS Implementation method
______
@Override
public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
viewPager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
}
@Override
public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
}
public class TabsPageAdapter extends FragmentStatePagerAdapter {
public TabsPageAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int i) {
return new MyWebBrowser();
}
@Override
public int getItemPosition(Object object) {
return PagerAdapter.POSITION_NONE;
}
@Override
public int getCount() {
return COUNT_TAB;
}
}
//____________________________________________
_____________BROWSER CLASS____________________
//____________________________________________
public class MyWebBrowser extends Fragment implements View.OnClickListener,View.OnLongClickListener{
View rootView;
@SuppressLint("AddJavascriptInterface")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.my_web_browser, container, false);
return rootView;
}
I
heard that I deleted my content for personal reasons, please advise me on this, thank you
Solution
I think you should try adding the following script in build.gradle. (Must be written in android{} tags).
lintOptions {
abortOnError false
}
When your release build generates errors through lint, the build task is not aborted.