android - Error import module Facebook 4.2.0 -
i have error when import facebook-sdk-4.2.0
d:\document\android\funnyphoto\facebook\build.gradle
(16, 0) not find property 'android_build_sdk_version' on project '-facebook'-
and have code in here
apply plugin: 'com.android.library' repositories { mavencentral() } project.group = 'com.facebook.android' dependencies { compile 'com.android.support:support-v4:[22,23)' compile 'com.parse.bolts:bolts-android:1.2.0' compile 'com.facebook.android:facebook-android-sdk:4.2.0' } android { compilesdkversion integer.parseint(project.android_build_sdk_version) buildtoolsversion project.android_build_tools_version defaultconfig { minsdkversion integer.parseint(project.android_build_min_sdk_version) targetsdkversion integer.parseint(project.android_build_target_sdk_version) } lintoptions { abortonerror false } sourcesets { main { manifest.srcfile 'androidmanifest.xml' java.srcdirs = ['src'] res.srcdirs = ['res'] } } compileoptions { sourcecompatibility javaversion.version_1_7 targetcompatibility javaversion.version_1_7 } } apply plugin: 'maven' apply plugin: 'signing' def issnapshot = version.endswith('-snapshot') def ossrhusername = hasproperty('nexus_username') ? nexus_username : "" def ossrhpassword = hasproperty('nexus_password') ? nexus_password : "" task setversion { // version derived source project.version = null def sdkversionfile = file('src/com/facebook/facebooksdkversion.java') sdkversionfile.eachline{ def matcher = (it =~ /(?:.*build = \")(.*)(?:\".*)/) if (matcher.matches()) { project.version = matcher[0][1] return } } if (project.version.is('unspecified')) { throw new gradlescriptexception('version not found.', null) } } uploadarchives { repositories.mavendeployer { beforedeployment { mavendeployment deployment -> signing.signpom(deployment) } repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { authentication(username: ossrhusername, password: ossrhpassword) } snapshotrepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { authentication(username: ossrhusername, password: ossrhpassword) } pom.project { name 'facebook-android-sdk' artifactid = 'facebook-android-sdk' packaging 'aar' description 'facebook android sdk' url 'https://github.com/facebook/facebook-android-sdk' scm { connection 'scm:git@github.com:facebook/facebook-android-sdk.git' developerconnection 'scm:git@github.com:facebook/facebook-android-sdk.git' url 'https://github.com/facebook/facebook-android-sdk' } licenses { license { name 'facebook platform license' url 'https://github.com/facebook/facebook-android-sdk/blob/master/license.txt' distribution 'repo' } } developers { developer { id 'facebook' name 'facebook' } } } } } uploadarchives.dependson(setversion) signing { required { !issnapshot && gradle.taskgraph.hastask("uploadarchives") } sign configurations.archives } task androidjavadocs(type: javadoc) { source = android.sourcesets.main.java.srcdirs classpath += project.files(android.getbootclasspath().join(file.pathseparator)) // jdk 1.8 more strict 1.7. have jdk 1.8 behave 1.7 javadoc generation if (org.gradle.internal.jvm.jvm.current().getjavaversion() == javaversion.version_1_8) { options.addstringoption('xdoclint:none', '-quiet') } } task androidjavadocsjar(type: jar, dependson: androidjavadocs) { classifier = 'javadoc' androidjavadocs.destinationdir } task androidsourcesjar(type: jar) { classifier = 'sources' android.sourcesets.main.java.sourcefiles } artifacts { archives androidsourcesjar archives androidjavadocsjar } afterevaluate { androidjavadocs.classpath += project.android.libraryvariants.tolist().first().javacompile.classpath }
those constants defined @ top level gradle.properties file. if imported facebook sdk module in project, should merge contents of file top level gradle.properties file, alternatively can add them build.gradle file in facebook.
all of unnecessary though, there easy way integrate project facebook android sdk via maven. need steps 4-5 in doc: https://developers.facebook.com/docs/android/getting-started#androidstudio
Comments
Post a Comment