Felix
Felix

Reputation: 1263

build android app using intellij idea cannot find theme AppCompat.Light

Now I am trying to build this android app using this tutorial . but when I add the example code below I got an error.

<activity android:name="MyActivity"
      android:label="@string/app_name"
      android:theme="@style/Theme.AppCompat.Light">

the error is :

AndroidManifest.xml:10: error: Error: No resource found that matches the given
name (at 'theme' with value '@style/Theme.AppCompat.Light').

I have tried many post on the internet but I didn`t find solutions about using intellij idea.

and all my code is here, but I think this is not the problem it must be something I forgot to config using idea :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.androidtwo"
          android:versionCode="1"
          android:versionName="1.0">
    <uses-sdk android:minSdkVersion="7"  android:targetSdkVersion="18" />

    <application android:label="@string/app_name"
                 android:icon="@drawable/ic_launcher">
        <activity android:name="MyActivity"
                  android:label="@string/app_name"
                  android:theme="@style/Theme.AppCompat.Light">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>

activity

package com.example.androidtwo;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;

public class MyActivity extends ActionBarActivity {
    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

Upvotes: 0

Views: 1151

Answers (1)

ligi
ligi

Reputation: 39539

your build.gradle has to contain this line:

compile 'com.android.support:appcompat-v7:19.1.0'

Upvotes: 2

Related Questions