radioaktiv
radioaktiv

Reputation: 2539

Can't add activity in Android Studio

I am trying to add another activity to my project but it seems like the options for that are greyed out

Here's what it looks like to me:

enter image description here

Upvotes: 4

Views: 6072

Answers (3)

Deleoper Hawi
Deleoper Hawi

Reputation: 31

I had the same problem to solve.

Go to Gradle and check the following settings:

defaultConfig {
    applicationId "com.hawiLLC.hawiblogapp"
    minSdkVersion 21
    targetSdkVersion 29
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Check on the minimum minSdkVersion.

Upvotes: 3

Natàlia Marta
Natàlia Marta

Reputation: 21

I had the same problem. In order to change the minumun SDK level in a Android Studio project I had to change it in build.gradleinstead of the AndroidManifest.xml. This is part of the file I modified:

android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion "23.0.3"

defaultConfig {
    applicationId "com.example.myfirstapp"
    minSdkVersion 9
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

Upvotes: 2

Alex K
Alex K

Reputation: 8338

You need to change your minimum SDK level. That's why it's greyed out - yours is set to be too low.

In your AndroidManifest.xml, right under <manifest . . . >, add this:

 uses-sdk android:minSdkVersion="15" />

You can change the value there to any value...you only really need 8 or higher for most of the activities you are trying to add.

Upvotes: 4

Related Questions