Today I am faced with a massive error that doesn\'t let me run a sample project on my phone.
When Android Studio is building the project, it first shows the followin
UNEXPECTED TOP-LEVEL EXCEPTION
means that you are getting included twice any .jar
.
As @Akhil said you should exclude support-v4
because I guess it's the main problem, but if @Akhil answer didn't help you try it out this method.
compile (':xyzSDK') {
exclude group: 'com.android.support', module: 'support-v4'
}
Have you tried to delete this line?
compile 'com.android.support:appcompat-v7:22.1.0'
Maybe :xyzSDK
allready has appcompat-v7:22+
..
I give you there a good answer by @CommonsWare to make a gradle report to see what's the problem.
I'm working for your answer, so if I find something interessant I'll be updating my answer.
Once you've done this you must Build -> Rebuild project
Also as I saw on @dan answer... I let you there a possible answer.
Instead of 1.7
as dan said try to :
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
Otherwise you can check it manually going to File > Project Structure
or Ctrl+Alt+Shift+S and then on the JDK location
see what are you using and if you are using 1.8 change to your 1.7 SDK path
And btw I think that I've read that you have asked if you could use JAVA 8
for Android instead of JAVA 7
if i'm not wrong.... and yes you could use JDK 8
, but only if you also use gradle-retrolamba
like says on this question..