java - Gradle project - can build but not run it -
my android project consist of 3 build.gradle
files:
projects build.gradle
:
// top-level build file can add configuration options common sub-projects/modules. buildscript { repositories { // mavenlocal() jcenter() } dependencies { // classpath 'com.android.tools.build:gradle:1.1.0' classpath 'com.android.tools.build:gradle:1.1.3' } } allprojects { repositories { jcenter() } }
myapp build.gradle
apply plugin: 'com.android.library' android { dexoptions { predexlibraries = false } compilesdkversion 17 buildtoolsversion "21.1.1" defaultconfig { minsdkversion 8 targetsdkversion 17 } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile 'com.android.support:support-v4:18.0.0' compile files('libs/cwac-adapterwrapper.jar') }
and facebook sdk:
apply plugin: 'com.android.library' android { dexoptions { predexlibraries = false } compilesdkversion 8 buildtoolsversion "21.1.1" defaultconfig { minsdkversion 8 targetsdkversion 8 } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile 'com.android.support:support-v4:18.0.0' }
i able build project not run it. exception is:
> note: input files use or override deprecated api. note: > recompile -xlint:deprecation details. note: input files > use unchecked or unsafe operations. note: recompile > -xlint:unchecked details. :awakenings:dexdebug unexpected top-level exception: java.lang.illegalargumentexception: > added: ledu/mit/mobile/android/imagecache/diskcache$1; @ > com.android.dx.dex.file.classdefssection.add(classdefssection.java:122) > @ com.android.dx.dex.file.dexfile.add(dexfile.java:161) @ > com.android.dx.command.dexer.main.processclass(main.java:732) @ > com.android.dx.command.dexer.main.processfilebytes(main.java:673) @ > com.android.dx.command.dexer.main.access$300(main.java:82) @ > com.android.dx.command.dexer.main$1.processfilebytes(main.java:602) > @ > com.android.dx.cf.direct.classpathopener.processarchive(classpathopener.java:284) > @ > com.android.dx.cf.direct.classpathopener.processone(classpathopener.java:166) > @ > com.android.dx.cf.direct.classpathopener.process(classpathopener.java:144) > @ com.android.dx.command.dexer.main.processone(main.java:632) @ > com.android.dx.command.dexer.main.processallfiles(main.java:510) @ > com.android.dx.command.dexer.main.runmonodex(main.java:279) @ > com.android.dx.command.dexer.main.run(main.java:245) @ > com.android.dx.command.dexer.main.main(main.java:214) @ > com.android.dx.command.main.main(main.java:106) unexpected top-level > exception: java.lang.illegalargumentexception: added: > lcom/facebook/accesstoken$1; @ > com.android.dx.dex.file.classdefssection.add(classdefssection.java:122) > @ com.android.dx.dex.file.dexfile.add(dexfile.java:161) @ > com.android.dx.command.dexer.main.processclass(main.java:732) @ > com.android.dx.command.dexer.main.processfilebytes(main.java:673) @ > com.android.dx.command.dexer.main.access$300(main.java:82) @ > com.android.dx.command.dexer.main$1.processfilebytes(main.java:602) > @ > com.android.dx.cf.direct.classpathopener.processarchive(classpathopener.java:284) > @ > com.android.dx.cf.direct.classpathopener.processone(classpathopener.java:166) > @ > com.android.dx.cf.direct.classpathopener.process(classpathopener.java:144) > @ com.android.dx.command.dexer.main.processone(main.java:632) @ > com.android.dx.command.dexer.main.processallfiles(main.java:510) @ > com.android.dx.command.dexer.main.runmonodex(main.java:279) @ > com.android.dx.command.dexer.main.run(main.java:245) @ > com.android.dx.command.dexer.main.main(main.java:214) @ > com.android.dx.command.main.main(main.java:106) 2 errors; aborting > error:execution failed task ':awakenings:dexdebug'. > > com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command > 'c:\program files\java\jdk1.8.0_20\bin\java.exe'' finished > non-zero exit value 1
something duplicated don't know what. have got ideas why not run?
the problem seems first 2 modules included twice in dex
settings.gradle include ':androidimagecachemaster' include ':facebooksdk'
and then
¸¸dependencies { compile project(':facebooksdk') compile project(':androidimagecachemaster')
here screen shot
is there function called diskcache in file: com.android.dx.command.main.main
this seems conflicting function in facebook sdk. try rename funciton
updated-------
try instead in build.grade. should compile dependency exclude final build:
android { compilesdkversion x buildtoolsversion "x" packagingoptions { exclude 'support-v4' } ... }
Comments
Post a Comment