Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New Android Application Project Can't Create Blank Activity

I am still new in android development and just decided to learn. however i encounter some problem that drive me nuts this couple hours.. i just want to create a new project with this setting

New Project Setting

the problem is i can't create new blank activity with it, it says it requires a build target API version of at least 14, and the current version is 8

Activity Warning

I just want to try build an app that support from Android 2.2 (API 8) onwards.. is that just not possible right now to create an Android 2.2 compatible apps with blank activity template? so in order to use blank activity template i must use Android 4.0 (API 14)? is that correct?

like image 908
Nikolius Lau Avatar asked Mar 31 '14 07:03

Nikolius Lau


4 Answers

It's new feature of ADT 22.6.2

Even in "None" theme ADT(22.6.2) create "Fragment Layout"

There is four ways:

  1. Try to change "Target" and "Compile" to API 14 or higher. But you need then remove all entries of "Fragment Layouts"

  2. Uncheck "Create activity" checkbox, and create activity manually. Good howto: Best way to add Activity to an Android project in Eclipse?

  3. Downgrade to 22.3.0 for example

  4. Try to change templates. In link below you find howto.

I use third way for my apps with APIs lower 14. In different directories I have installed 22.3.0 and 22.6.2

There in 22.6.2 is some other bugs with blank files and problems with AVD. New version of ADT really buggy...

Look also this links:

ADT blank activity created with fragment activity..

Eclipse doesn't generate MainActivity.java & activity_main.xml

and search, yep )

https://stackoverflow.com/search?q=adt+22.6


Added some new ways.

How I use it now:

  1. You can create project in 22.3.0 or lower. Then open it in 22.6 or greater.
  2. You can create project in 22.3.0 or lower and leave it blank. Then in 22.6 or greater you can use this blank project as template. Just copy this template-project and past it with new name as you new-project in Eclipse workspase.

Enjoy! )

like image 106
user3439968 Avatar answered Oct 13 '22 13:10

user3439968


it is going to be tricky building for such a version, you may leave you minimum Sdk at yoru desired. Still you must increase max, also if your minimum is anything less than 15, the ADK is now building an extra folder(new stuff) In truth the new version of the ADt is annoying, I am just starting and now you will see they have enforced the use of fragments.

like image 28
user3459475 Avatar answered Oct 13 '22 13:10

user3459475


I figured out that we can use Empty Activity instead of Blank Activity. Now in Empty is created a fragment, layout and R.java is updated.

like image 41
Harison Silva Avatar answered Oct 13 '22 12:10

Harison Silva


I was in the same boat so I tried....And it worked!

This is with a brand new empty project i tried to start with SDK 8 set for min and target.

I was able to change the min and target SDK to a higher version(in my case 21). That allowed me to add an "Empty Activity". After the activity was added I just change the min and target back to 8. There were not any compile complaints and I was able to run it in a 2.2 emulator after I did the change

like image 37
user1807268 Avatar answered Oct 13 '22 14:10

user1807268