Android gradle design library null pointer exception

I am trying to add android.support.design library to my project: all interesting things in my gradle file:

 dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:design:22.2.0' compile 'com.android.support:support-annotations:22.0.0' compile 'com.android.support:support-v13:22.1.1' compile 'com.android.support:recyclerview-v7:22.1.1' compile 'com.android.support:cardview-v7:22.1.0' } 

I get

 Error:Android Gradle Build Target: java.lang.NullPointerException 

com.android.support:design:22.2.0 (and adding back v4 and AppCompat ) the assembly will succeed.

library version

Another similar problem didn't help me

Please note that I create using Intellij 14

+7
android android-support-library android-design-library
source share
2 answers

I ran the app using android studio and not IntelliJ 14 and got another error:

 `Error:(1) Attribute "insetForeground" has already been defined` 

So, if someone is running IntelliJ 14 , until the next IntelliJ 14 update, I think it is safer to use android studio 1.3.+ (Or at least check for errors using android studio .

If you get the same error.

  • go to attr.xml and delete declare-styleable name="ScrimInsetsView"

  • using ctrl-shift-f to search for insetF and remove the app:insetForeground from the entire layout that contains such an attribute.

Now everything should work fine

0
source share

I had exactly the same problem. I assume this comes from a combination of inappropriate parameters in the class and your xml resources. Maybe this will help (for me it was):

 buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.1.1' } } apply plugin: 'com.android.application' ... dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:23.0.0' compile 'com.android.support:design:23.0.0' compile 'com.android.support:cardview-v7:21.0.3' compile 'com.android.support:recyclerview-v7:21.0.3' } 

Give build.grade 1.1.1 too (just in case)

 // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.1.1' } } allprojects { repositories { jcenter() } } 

Hopefully the next sync, cleanup, and rebuild will work (or trigger a meaningful error message like "color-res blabla not found").

Btw: from time to time my IntelliJ tunes to other Java configs (for example, Java8 with lambdas) - just in case: Remember to check if the SDK of the project is configured correctly (File> Project-structure> project> select the SDK).

0
source share

All Articles