I have a "base" library, which provides pure Java code, now I want to create a Android library on top of that. Let's say both libraries have a Log class. When I build the aar and nest it in a project, I am able to choose which Log class I want to import (which I try to prevent, only the Log class from the Android-library should be shown). Is there is a chance to exclude the library when the aar gets build?
Here is the gradle (I tried a lot, but nothing helped).
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
}
apply plugin: 'com.android.library'
repositories {
jcenter()
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 9
targetSdkVersion 23
versionCode 9
versionName "0.0.9"
project.archivesBaseName = "andcommon"
project.version = android.defaultConfig.versionName
}
packagingOptions {
// exclude 'res'
}
// configurations {
// compile.exclude group: 'com.pepperonas.jbasx'
// }
// sourceSets {
// main {
// java {
// exclude '**/Log.java'
// }
// }
// }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
all {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
libraryVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.aar')) {
def fileName = "${archivesBaseName}-${version}.aar"
output.outputFile = new File(outputFile.parent, fileName)
output.outputFile = new File("/home/pepperonas/IdeaProjects/Libraries/Base/testapp/libs", fileName)
}
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.0'
compile project(':jbasx')
// compile files('libs/jbasx-0.0.9.jar')
}
Related
enter image description hereAfter updating android studion 3.2.1 iam getting this error . Actually StreamLib Module is using for supportive module there is no buildscript, allmodules blocks please check the StreamLib.gridle
Could not find com.android.tools.build:aapt2:3.2.1-4818971.
Searched in the following locations:
file:/Users/user/Library/Android/sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom
file:/Users/user/Library/Android/sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971-osx.jar
file:/Users/user/Library/Android/sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom
file:/Users/user/Library/Android/sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971-osx.jar
file:/Users/user/Library/Android/sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom
file:/Users/user/Library/Android/sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971-osx.jar
Required by:
project :StreamingLib
this is the StreamingLib Gridle file :
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
// android.enableAapt2=false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
jniLibs.srcDirs 'src/main/libs'
jni.srcDirs = []
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation files('libs/aapt2-3.2.1-4818971-windows.jar')
}
the above StreamingLib using for supportive library for my app
please help me ?
this is main level graidle file
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
apply plugin: 'com.android.application'
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
implementation 'com.google.android.gms:play-services-gcm:10.2.6'
implementation 'org.sufficientlysecure:openpgp-api:10.0'
implementation 'com.soundcloud.android:android-crop:1.0.1#aar'
implementation 'com.android.support:support-v13:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'org.bouncycastle:bcprov-jdk15on:1.52'
implementation 'org.bouncycastle:bcmail-jdk15on:1.52'
implementation 'org.jitsi:org.otr4j:0.22'
implementation 'org.gnu.inet:libidn:1.15'
implementation 'com.google.zxing:core:3.2.1'
implementation 'com.google.zxing:android-integration:3.2.1'
implementation 'de.measite.minidns:minidns-hla:0.2.1'
implementation 'de.timroes.android:EnhancedListView:0.3.4'
implementation 'me.leolin:ShortcutBadger:1.1.12#aar'
implementation 'com.kyleduo.switchbutton:library:1.2.8'
implementation 'org.whispersystems:signal-protocol-java:2.5.3'
implementation 'com.wefika:flowlayout:0.4.1'
implementation 'net.ypresto.androidtranscoder:android-transcoder:0.2.0'
implementation 'com.mcxiaoke.volley:library-aar:1.0.0'
implementation 'com.googlecode.libphonenumber:libphonenumber:6.2'
implementation project(':StreamingLib')
}
ext {
travisBuild = System.getenv("TRAVIS") == "true"
// allows for -Dpre-dex=false to be set
preDexEnabled = "true".equals(System.getProperty("pre-dex", "true"))
}
android {
compileSdkVersion 26
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 19
targetSdkVersion 26
versionCode 3
versionName "2.0"
archivesBaseName += "-$versionName"
applicationId "com.abc"
multiDexEnabled true
//
}
dexOptions {
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
preDexLibraries = preDexEnabled && !travisBuild
javaMaxHeapSize "4g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
if (project.hasProperty('mStoreFile') &&
project.hasProperty('mStorePassword') &&
project.hasProperty('mKeyAlias') &&
project.hasProperty('mKeyPassword')) {
signingConfigs {
release {
storeFile file(mStoreFile)
storePassword mStorePassword
keyAlias mKeyAlias
keyPassword mKeyPassword
}
}
buildTypes.release.signingConfig = signingConfigs.release
} else {
buildTypes.release.signingConfig = null
}
lintOptions {
disable 'ExtraTranslation', 'MissingTranslation', 'InvalidPackage', 'MissingQuantity', 'AppCompatResource'
}
subprojects {
afterEvaluate {
if (getPlugins().hasPlugin('android') ||
getPlugins().hasPlugin('android-library')) {
configure(android.lintOptions) {
disable 'AndroidGradlePluginVersion', 'MissingTranslation'
}
}
}
}
packagingOptions {
exclude 'META-INF/BCKEY.DSA'
exclude 'META-INF/BCKEY.SF'
}
}
I want to use Checker Framework to do some static analysis of my app- checking for Nullability failures, UI constraint failures, etc at runtime. I followed the instructions at https://checkerframework.org/manual/#android-gradle to try and make it run, but I'm getting an error that checkTypes is not a task. I think I followed the instructions correctly, and I fixed the capitalization mismatch they had. ANy ideas how to fix it? My build.gradle is below:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
apply plugin: 'jacoco'
apply plugin: 'com.getkeepsafe.dexcount'
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xmaxerrs" << "500"
}
}
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.handshake.hsdm"
minSdkVersion 19
targetSdkVersion 25
versionCode 35
versionName "0.0.35"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
testCoverageEnabled = false
}
debug {
testCoverageEnabled = false
}
checkTypes {
javaCompileOptions.annotationProcessorOptions.
classNames.add("org.checkerframework.checker.guieffect.GuiEffectChecker")
// You can pass options like so:
// javaCompileOptions.annotationProcessorOptions.arguments.put("warns", "")
}
}
dexOptions {
preDexLibraries = false
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
}
}
packagingOptions {
//These files constantly step on each other from multiple libraries, don't include them
exclude 'META-INF/ASL2.0'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/*'
exclude 'plugin.xml'
exclude 'plugin.properties'
exclude 'about_files/LICENSE-2.0.txt'
}
testOptions {
unitTests.all {
jacoco {
includeNoLocationClasses = true
}
}
}
jacoco {
version = '0.7.3.201502191951'
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:2.0.1'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
configurations {
checkerFrameworkAnnotatedJDK {
description = 'a copy of JDK classes with Checker Framework type qualifers inserted'
}
}
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
reports {
xml.enabled = true
html.enabled = true
}
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*',
'com/handshake/hsdm/demo/**','com/handshake/hsdm/localstorage/schema1/*Dao*',
'com/handshake/hsdm/localstorage/schema1/*Factory*', 'com/handshake/hsdm/dagger2',
'**/*Module*', '**/*_Factory*', '**/*_MembersInjector*'
]
def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter)
def mainSrc = "${project.projectDir}/src/main/java"
sourceDirectories = files([mainSrc])
classDirectories = files([debugTree])
executionData = fileTree(dir: "$buildDir", includes: [
"jacoco/testDebugUnitTest.exec",
"outputs/code-coverage/connected/*coverage.ec"
])
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, exclude: ['com/handshake/hsdm/demo/**'])
})
}
}
dependencies {
//Clipping dependencies
ext.checkerFrameworkVersion = '2.2.1'
implementation "org.checkerframework:checker-qual:${checkerFrameworkVersion}"
annotationProcessor "org.checkerframework:checker:${checkerFrameworkVersion}"
checkerFrameworkAnnotatedJDK "org.checkerframework:jdk8:${checkerFrameworkVersion}"
}
apply plugin: 'com.google.gms.google-services'
gradle.projectsEvaluated {
tasks.withType(JavaCompile).all { compile ->
if (compile.name.contains("checkTypes")) {
compile.options.compilerArgs += [
"-Xbootclasspath/p:${configurations.checkerFrameworkAnnotatedJDK.asPath}"
]
}
}
}
Edit: For future readers- the line javaCompileOptions.annotationProcessorOptions.classNames +=["org.checkerframework.checker.nullness.NullnessChecker"] seems to be the problem. removing it runs dagger and other annotation processors, but obviously won't run the checker.
So apparently if you specify 1 annotation processor via classnames, it overwrites any others. So I had to specify dagger and autofactory as well. Then I can either run it from Android Studio as a build, or from command line as:
gradlew assembleCheckTypes
I have project in Kotlin and I have updated Android Studio to 2.3.3 and gradle to 3.3 and build tools to 25.3.1. During building I got this error:
Caused by: java.lang.UnsupportedOperationException: The "android" command is no longer included in the SDK. Any references to it (e.g. by third-party plugins) should be removed.
at com.android.SdkConstants.androidCmdName(SdkConstants.java:1947)
at com.android.SdkConstants$androidCmdName$0.callStatic(Unknown Source)
at com.jakewharton.sdkmanager.internal.AndroidCommand$Real.<init>(AndroidCommand.groovy:21)
at com.jakewharton.sdkmanager.internal.PackageResolver.resolve(PackageResolver.groovy:22)
at com.jakewharton.sdkmanager.internal.PackageResolver$resolve.call(Unknown Source)
at com.jakewharton.sdkmanager.SdkManagerPlugin$_apply_closure2$_closure3.doCall(SdkManagerPlugin.groovy:44)
at com.jakewharton.sdkmanager.SdkManagerPlugin$_apply_closure2$_closure3.doCall(SdkManagerPlugin.groovy)
at com.jakewharton.sdkmanager.SdkManagerPlugin.time(SdkManagerPlugin.groovy:51)
at com.jakewharton.sdkmanager.SdkManagerPlugin$_apply_closure2.doCall(SdkManagerPlugin.groovy:43)
at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy16.afterEvaluate(Unknown Source)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:82)
... 56 more
Gralde file:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
jcenter()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.github.JakeWharton:sdk-manager-plugin:master'
}
}
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
apply plugin: 'io.fabric'
task increaseBuildStageVersion << {
def versionPropsFileI = file('version.properties')
if (versionPropsFileI.canRead()) {
def Properties versionPropsI = new Properties()
versionPropsI.load(new FileInputStream(versionPropsFileI))
def value = 1
println("INCREASING STAGE VERSION")
def versionBuild = versionPropsI['VERSION_BUILD_STAGE'].toInteger() + value
def codeVersion = versionPropsI['VERSION_CODE_STAGE'].toInteger() + value
versionPropsI['VERSION_BUILD_STAGE'] = versionBuild.toString()
versionPropsI['VERSION_CODE_STAGE'] = codeVersion.toString()
versionPropsI.store(versionPropsFileI.newWriter(), null)
} else {
throw new GradleException("Could not read version.properties!")
}
}
task increaseBuildProductionVersion << {
def versionPropsFileI = file('version.properties')
if (versionPropsFileI.canRead()) {
def Properties versionPropsI = new Properties()
versionPropsI.load(new FileInputStream(versionPropsFileI))
def value = 1
println("INCREASING PRODUCTION VERSION")
def versionBuild = versionPropsI['VERSION_BUILD_PRODUCTION'].toInteger() + value
def codeVersion = versionPropsI['VERSION_CODE_PRODUCTION'].toInteger() + value
versionPropsI['VERSION_BUILD_PRODUCTION'] = versionBuild.toString()
versionPropsI['VERSION_CODE_PRODUCTION'] = codeVersion.toString()
versionPropsI.store(versionPropsFileI.newWriter(), null)
} else {
throw new GradleException("Could not read version.properties!")
}
}
tasks.whenTaskAdded { task ->
if (task.name == 'packageStageRelease') {
task.dependsOn increaseBuildStageVersion
} else if (task.name == 'packageProductionRelease') {
task.dependsOn increaseBuildProductionVersion
}
}
android {
signingConfigs {
release {
.....
}
}
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.fivedottwelve.bonusapp"
minSdkVersion 19
targetSdkVersion 25
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
signingConfig signingConfigs.release
def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
def buildTime = new GregorianCalendar().format("dd-MM-yyyy' 'h:mm:ss a Z")
buildConfigField "String", "GIT_SHA", "\"{$gitSha}\""
buildConfigField "String", "BUILD_TIME", "\"{$buildTime}\""
}
debug {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
buildConfigField "String", "GIT_SHA", "\"DEBUG\""
buildConfigField "String", "BUILD_TIME", "\"BUILD_TIME\""
}
}
productFlavors {
development {
versionName "1.0." + getStageVersionName() + "-stage"
versionCode getStageVersionCode()
applicationIdSuffix ".stage"
resValue "string", "app_name", "BonusApp"
buildConfigField('String', 'API_URL', "\"https://fivedottwelve.com/\"")
}
stage {
versionName "1.0." + getStageVersionName() + "-stage"
versionCode getStageVersionCode()
applicationIdSuffix ".stage"
resValue "string", "app_name", "BonusApp"
buildConfigField('String', 'API_URL', "\"https://fivedottwelve.com/\"")
}
production {
versionName "1.0." + getProdVersionName()
versionCode getProdVersionCode()
resValue "string", "app_name", "BonusApp"
buildConfigField('String', 'API_URL', "\"https://fivedottwelve.com/\"")
}
}
dexOptions {
preDexLibraries true
maxProcessCount 6
javaMaxHeapSize "3g"
}
testOptions {
unitTests.all {
// All the usual Gradle options.
testLogging {
jvmArgs '-XX:MaxPermSize=256m'
events "passed", "skipped", "failed", "standardOut", "standardError"
outputs.upToDateWhen { false }
showStandardStreams = true
}
}
}
lintOptions {
disable 'InvalidPackage', 'ContentDescription'
abortOnError false
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
packagingOptions {
exclude 'main/AndroidManifest.xml'
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'LICENSE.txt'
exclude 'LICENSE'
}
}
kapt {
generateStubs = true
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile 'com.github.salomonbrys.kotson:kotson:2.5.0'
compile "com.android.support:support-v4:$rootProject.ext.android_support_version"
compile "com.android.support:appcompat-v7:$rootProject.ext.android_support_version"
compile "com.android.support:design:$rootProject.ext.android_support_version"
compile "com.android.support:recyclerview-v7:$rootProject.ext.android_support_version"
compile "com.android.support:cardview-v7:$rootProject.ext.android_support_version"
compile 'com.android.support:multidex:1.0.1'
compile "com.google.android.gms:play-services-base:$rootProject.ext.play_service_version"
compile "com.google.android.gms:play-services-gcm:$rootProject.ext.play_service_version"
kapt "com.google.dagger:dagger-compiler:$rootProject.ext.Dagger_version"
compile "com.google.dagger:dagger:$rootProject.ext.Dagger_version"
compile "io.reactivex:rxjava:$rootProject.ext.RxJava_version"
compile "io.reactivex:rxandroid:$rootProject.ext.RxAndroid_version"
provided 'javax.annotation:jsr250-api:1.0'
compile "com.squareup.okhttp3:okhttp:$rootProject.ext.retrofit_http_version"
compile "com.squareup.okhttp3:okhttp-urlconnection:$rootProject.ext.retrofit_http_version"
compile "com.squareup.okhttp3:logging-interceptor:$rootProject.ext.retrofit_http_version"
compile "com.squareup.retrofit2:retrofit:$rootProject.ext.retorfit_version"
compile "com.squareup.retrofit2:converter-gson:$rootProject.ext.retorfit_version"
compile "com.squareup.retrofit2:adapter-rxjava:$rootProject.ext.retorfit_version"
compile 'com.facebook.android:facebook-android-sdk:4.20.0'
compile 'me.relex:circleindicator:1.2.1#aar'
//glide
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0#aar'
//transitions
compile "com.andkulikov:transitionseverywhere:1.7.0"
//beacons
compile "com.kontaktio:sdk:$rootProject.ext.kontakt_io"
compile('com.crashlytics.sdk.android:crashlytics:2.6.7#aar') {
transitive = true;
}
}
repositories {
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
maven { url 'http://maven.livotovlabs.pro/content/groups/public' }
maven { url 'https://maven.fabric.io/public' }
}
/*
Resolves dependency versions across test and production APKs, specifically, transitive
dependencies. This is required since Espresso internally has a dependency on support-annotations.
*/
configurations.all {
resolutionStrategy.force "com.android.support:support-annotations:$rootProject.ext.android_support_version"
}
/*
All direct/transitive dependencies shared between your test and production APKs need to be
excluded from the test APK! This is necessary because both APKs will contain the same classes. Not
excluding these dependencies from your test configuration will result in an dex pre-verifier error
at runtime. More info in this tools bug: (https://code.google.com/p/android/issues/detail?id=192497)
*/
configurations.compile.dependencies.each { compileDependency ->
println "Excluding compile dependency: ${compileDependency.getName()}"
configurations.androidTestCompile.dependencies.each { androidTestCompileDependency ->
configurations.androidTestCompile.exclude module: "${compileDependency.getName()}"
}
}
I removed apply plugin: 'android-sdk-manager' and it works
I have a problem in which I open an old project and I get the errors below. I searched on internet how to solve it. The project already has dependencies with Facebook but I don't know why it doesn't appear in modules (automatic gradle) and when i try to import a new facebook sdk, it tells me that i already have a Facebook module... Anyone with the same problem?
Error:(26, 20) error: cannot find symbol class Request
Error:(27, 20) error: cannot find symbol class Session
Error:(28, 20) error: cannot find symbol class SessionState
Error:(29, 20) error: cannot find symbol class UiLifecycleHelper
Error:(30, 26) error: package com.facebook.model does not exist
Error:(31, 27) error: package com.facebook.widget does not exist
Error:(110, 13) error: cannot find symbol class UiLifecycleHelper
Error:(111, 20) error: package Session does not exist
Error:(540, 45) error: cannot find symbol class Session
Gradle:
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/repo' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.2'
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/repo' }
}
android {
compileOptions { sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7 }
compileSdkVersion 22
buildToolsVersion '22'
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName '0.85.1.0'
applicationId 'com.xxxxx'
multiDexEnabled = true
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
signingConfigs {
debug {
storeFile file('keys/debug.keystore')
}
release {
storeFile file('keys/xxx.jks')
storePassword 'xxx'
keyAlias 'xxx'
keyPassword 'xxx'
}
// debug {
// storeFile file("keys/debug.keystore")
// }
}
productFlavors {
local {
resValue "string", "URL", 'xxx'
resValue "string" , "Debug", '1'
versionName = android.defaultConfig.versionName + "_local"
}
remote {
resValue "string", "URL", 'xxx'
resValue "string" , "Debug", '0'
versionName = android.defaultConfig.versionName + "_remote"
}
}
defaultConfig {
testApplicationId "com.xxx.test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
}
productFlavors {
}
lintOptions {
abortOnError false
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def apk = outputFile;
def newName;
newName = apk.name.replace(".apk", variant.name +"-v" + defaultConfig.versionName + "_" + variant.name + ".apk")
.replace(project.name, "xxx");
// newName = newName
// .replace("-" + variant.buildType.name, "")
// .replace(project.name, "xxx");
//output.outputFile = new File(apk.parentFile, newName);
if (output.zipAlign) {
//variant.outputFile = new File(apk.parentFile, newName.replace("-unaligned", ""));
newName = newName.replace("-unaligned", "");
}
//def fileName = outputFile.name.replace('.apk', "-${versionName}.apk")
output.outputFile = new File(outputFile.parent, newName)
logger.info('INFO: Set outputFile to ' + output.outputFile + " for [" + output.name + "]");
}
}
}
}
dependencies {
// compile project(':facebook')
compile 'com.android.support:support-v13:21.0.0'
// compile 'com.google.android.gms:play-services:7.0.0'
compile 'com.google.android.gms:play-services-base:7.3.0'
compile 'com.google.android.gms:play-services-maps:7.3.0'
compile 'com.google.android.gms:play-services-gcm:7.3.0'
compile 'com.google.android.gms:play-services-identity:7.3.0'
compile 'com.google.android.gms:play-services-plus:7.3.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile project(':PuntechSensorsLib')
compile ("com.doomonafireball.betterpickers:library:1.5.3") {
exclude group: 'com.android.support', module: 'support-v4'
}
compile('com.crashlytics.sdk.android:crashlytics:2.0.1#aar') {
transitive = true;
}
}
ext.betaDistributionGroupAliases="internal"
It's because of conflicts in your XML files.
As the errors tell you, several xml files (in your res folders, maybe "attr" ones but I cannot be sure) has the same name in different projects.
Maybe they belong to your definitions or third's, but the ID for your resources must be unique.
Try checking if they can be yours and rename them.
EDIT:
Now I can see your errors,
Add jcenter() to your repos. Facebook artifacts seem to be there. You don't need to remove your previous one.
In your repositories zone:
repositories {
jcenter() // IntelliJ main repo.
}
In case you already have a "facebook" module, remove it from your project structure (file -> project structure) and you can also delete your module files in case you want to clean your project. (attention: all of this only if you didn't customize anything from "facebook" module").
With gradle, you only need import it from your build.gradle, and not having your own "facebook" module.
When I was using compile 'com.facebook.android:facebook-android-sdk:4.0.0' I had the same problem. I used compile 'com.facebook.android:facebook-android-sdk:3.23.1' instead and my project was built successfully. I do not know if it has something to do with upgrading from 3.x to 4.0.
I am using ./gradlew assembleRelease command to generate release apk for the app.On installing the app I am getting 2 icons of app.No clue what am I missing.No luch on google.
On clicking the second icon it just shows Simple Indeterminate.
Here is my build.gradle file:
buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.0.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
android {
compileSdkVersion 21
buildToolsVersion '20.0.0'
defaultConfig {
versionCode 23
versionName "1.1.8.5"
applicationId "com.squad.run"
minSdkVersion 10
targetSdkVersion 20
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
signingConfigs {
//Set debug.keystore file here
release {
def propsFile = rootProject.file('keystore.properties')
def Properties props = new Properties()
props.load(new FileInputStream(propsFile))
storeFile = file(props['storeFile'])
storePassword = props['storePassword']
keyAlias = props['keyAlias']
keyPassword = props['keyPassword']
}
}
buildTypes {
debug {
applicationIdSuffix ".debug"
ext.enableCrashlytics = false
}
release {
zipAlign true
signingConfig signingConfigs.release
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
// compile 'com.android.support:support-v4:20.0.0'
compile project(':Libraries:viewPagerIndicator_Squadrun')
compile project(':Libraries:facebookSDK')
compile project(':Libraries:library')
compile project(':Libraries:progressHUD_Squadrun')
compile project(':Libraries:slidingMenuLibrary_SquadRun')
compile project(':Libraries:MobihelpSDK')
compile 'com.squareup.retrofit:retrofit:1.5.1'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.android.gms:play-services:6.1.71'
compile 'com.android.support:appcompat-v7:21'
compile 'com.squareup.picasso:picasso:2.3.4'
compile 'org.apache.httpcomponents:httpmime:4.2.3'
compile 'com.squareup.okhttp:okhttp:1.6.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:1.6.0'
compile 'oauth.signpost:signpost-commonshttp4:1.2.1.2'
compile 'org.twitter4j:twitter4j-core:4.0.1'
compile files('libs/FlurryAnalytics-4.1.0.jar')
compile 'com.crashlytics.android:crashlytics:1.0.0'
}
My top guess is that there is more than one LAUNCHER activity, and that one of them is declared in a library project. Eclipse didn't merge the manifests, but Gradle does.
So, I would suggest you search for android.intent.action.MAIN in all AndroidManifest.xml files.