eclipse - Errors while porting project to Android Studio? -
i'm new android studio, i've been using eclipse 2 years. i've trying understanding these solutions.
android gradle build error:(9, 0) gradle dsl method not found: 'compile()'.
gradle dsl method not found: 'compile()'
i can't work.
here's says..
error:(17, 0) gradle dsl method not found: 'compile()' possible causes:
and
'dependencies' cannot applied '(groovy.lang.closure)' less... (⌘f1) inspection reports assignments incompatible types
here's file it's giving error
// top-level build file can add configuration options common sub-projects/modules. buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:1.1.0' } } allprojects { repositories { mavencentral() } } dependencies { apply plugin: 'announce' compile 'com.android.support:appcompat-v7:21.0.0' compile 'com.android.support:cardview-v7:21.0.+' }
and based on other questions, may need too.
apply plugin: 'android' android { compilesdkversion 17 buildtoolsversion "19.0.3" defaultconfig { minsdkversion 8 targetsdkversion 19 } buildtypes { release { runproguard false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile 'com.android.support:support-v4:+' compile files('libs/flurryanalytics_3.3.0.jar') compile files('libs/heyzap-ads-sdk.jar') compile files('libs/homebasesdk2.2.jar') compile files('libs/placed-persistent-sdk-1.10.jar') compile files('libs/revmob-6.7.0.jar') }
can me understand problem is, , why it's happening?
this might not answer question maybe can project running. these dependencies dont belong in first build.gradle file :
dependencies { apply plugin: 'announce' compile 'com.android.support:appcompat-v7:21.0.0' compile 'com.android.support:cardview-v7:21.0.+' }
your dependencies in project build.gradle should this, comment generated ide , tells not put app dependencies here :
dependencies { classpath 'com.android.tools.build:gradle:1.1.0' // note: not place application dependencies here; belong // in individual module build.gradle files }
move them /app/build.gradle file, , modified file little date newest version of buildtools etc. might have download of them sdk manager if dont have :
apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { applicationid "your.package.name" minsdkversion 8 targetsdkversion 22 } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.android.support:support-v4:+' compile files('libs/flurryanalytics_3.3.0.jar') compile files('libs/heyzap-ads-sdk.jar') compile files('libs/homebasesdk2.2.jar') compile files('libs/placed-persistent-sdk-1.10.jar') compile files('libs/revmob-6.7.0.jar') }
Comments
Post a Comment