Android Studio XML does not recognize objectAnimator

FutureProg picture FutureProg · Aug 5, 2014 · Viewed 7.2k times · Source

I have been trying to animate a transition between two fragments. I had originally placed them a property animations in xml (and that didn't really work), then changed it to objectAnimator. For some reason Android Studio is not recognizing the objectAnimator tag.

here is my AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.nick.randomapplication" >

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

my build.Gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.example.nick.randomapplication"
        minSdkVersion 19
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile "com.android.support:appcompat-v7:20.0.+"
}

and the xml file:

<?xml version="1.0" encoding="utf-8"?>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android">
</objectAnimator>

Thank you for taking your time to look at this. I'm not sure what to do anymore.

Answer

justqb picture justqb · Jun 19, 2015

I think you have placed the xml file in a wrong folder.

valueAnimator objectAnimator and animatorSet resources should be in the folder res/animator, not in res/anim.

please visit android developer for more information. http://developer.android.com/guide/topics/resources/animation-resource.html