Question

I am facing some problem in android suppport v7 app compat. is giving error that some jar missing. I want to make a simple hello world app with android support v4 or something, but how to remove android support v7?

Était-ce utile?

La solution

It's a bit of a chore to remove it. It's easiest to just create a new project, unchecking "Create Activity" in the wizard and then add a new class to src.

But if you really, really want to remove the v7 stuff from an existing project, here's one way to remove it, the action bar, and the fragments stuff:

  • Delete the android.libary.reference line from project.properties, ignoring the warning at the top.
  • Change the type of MainActivity from ActionBarActivity to just Activity.
  • Delete the v7 and v4.Fragment imports.
  • Delete the whole "if (savedInstanceState)" statement from MainActivity.
  • Delete the PlaceholderFragment class from MainActivity.
  • Replace the contents of activty_main.xml file with the contents of fragment_main.mxl or your own layout.
  • If you didn't use your own layout, remove the tools:context attribute/value from activity_main.xml.
  • Edit each of the 3 styles.xml files (under values*) and change the parent of style AppBaseTheme to "android:Theme.Light" (or your choice).
  • Edit menu/main.mxl and remove the app:showAsAction attribute/value.
  • Organize imports and clean your project.

Just to be clear: this isn't something you really want to do for a real app, but more something that you might want to do if you're just creating a demo or proof of concept.

Edit:

Going forward, you can add an additional template that creates an Activity without appcompat_v7. You can get one by CommonsWare here. There's a nice write about it here.

Autres conseils

For your information this happened because you upgraded your ADT to the most recent version (22 I think).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top