Cannot find symbol class error in Android Studio - android

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.

Related

Project 'app' not found in root project 'MobileBuy'

FAILURE: Build failed with an exception.
What went wrong:
Project 'app' not found in root project 'MobileBuy'.
getting above error when I build project. but in my android project no app folder then why this Project 'app' not found in root project 'MobileBuy' getting this error.
settings.gradle
include ':sample', ':buy3', ':buy3-pay-support', ':graphql-java-support'
project(':graphql-java-support').projectDir = new File('./libs/graphql_java_gen/support')
build.gradle
buildscript {
dependencies {
classpath dep.androidPlugin
classpath dep.retrolambda
classpath dep.butterknifePlugin
classpath dep.apolloPlugin
}
}
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'com.apollographql.android'
android {
compileSdkVersion androidConfig.compileSdkVersion
buildToolsVersion androidConfig.buildToolsVersion
defaultConfig {
applicationId "com.shopify.sample"
minSdkVersion androidConfig.minSdkVersion
targetSdkVersion androidConfig.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
all {
buildConfigField 'okhttp3.logging.HttpLoggingInterceptor.Level', 'OKHTTP_LOG_LEVEL', 'okhttp3.logging.HttpLoggingInterceptor.Level.BODY'
// We pull the shop settings either from the Environment or a file called shop.properties at the root of the project.
// Environment variables will take precedence, we will attempt to read those first.
def shopDomain
def apiKey
def androidPayPublicKey
def androidPayEnvironment
// get the shop setting from the environment if there any
shopDomain = System.getenv("SHOP_DOMAIN")
apiKey = System.getenv("API_KEY")
androidPayPublicKey = System.getenv("ANDROID_PAY_PUBLIC_KEY")
androidPayEnvironment = System.getenv("ANDROID_PAY_ENVIRONMENT")
// pull the store properties from the local file if it exists. Environment variables take precedence
def shopProperties = new Properties();
File shopPropertiesFile = project.file('shop.properties')
if (shopPropertiesFile.exists()) {
shopProperties.load(new FileInputStream(shopPropertiesFile))
shopDomain = shopDomain ?: shopProperties["SHOP_DOMAIN"]
apiKey = apiKey ?: shopProperties["API_KEY"]
androidPayPublicKey = androidPayPublicKey ?: shopProperties["ANDROID_PAY_PUBLIC_KEY"]
androidPayEnvironment = androidPayEnvironment ?: shopProperties["ANDROID_PAY_ENVIRONMENT"]
}
if (!shopDomain) {
shopDomain = ""
}
if (!apiKey) {
apiKey = ""
}
if (!androidPayPublicKey) {
androidPayPublicKey = ""
}
if (!androidPayEnvironment) {
androidPayEnvironment = "com.google.android.gms.wallet.WalletConstants.ENVIRONMENT_SANDBOX"
}
buildConfigField "String", "SHOP_DOMAIN", "\"" + shopDomain.toString() + "\""
buildConfigField "String", "API_KEY", "\"" + apiKey.toString() + "\""
buildConfigField "String", "ANDROID_PAY_PUBLIC_KEY", "\"" + androidPayPublicKey.toString() + "\""
buildConfigField "int", "ANDROID_PAY_ENVIRONMENT", androidPayEnvironment
debuggable = true
minifyEnabled = false
}
}
productFlavors {
shopify {
}
xApollo {
}
}
lintOptions {
abortOnError false
}
}
dependencies {
compile dep.androidSupportDesign
compile dep.androidSupportV4
compile dep.androidSupportV7
compile dep.androidSupportAnnotations
compile dep.rxAndroid
compile dep.rxJava
compile dep.timber
compile dep.butterKnife
compile 'com.ss.bannerslider:bannerslider:1.8.0'
compile 'com.ss.bottomnavigation:bottomnavigation:1.5.2'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'org.apmem.tools:layouts:1.10#aar'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
annotationProcessor dep.butterKnifeCompiler
compile(dep.fresco) {
exclude group: 'com.android.support'
}
compile dep.constraintLayout
compile dep.rxrelay
compile dep.archRuntime
compile dep.archExt
annotationProcessor dep.arcCompiler
compile project(':buy3-pay-support')
shopifyCompile project(':buy3')
xApolloCompile dep.apolloRuntime
xApolloCompile dep.okhttpLogging
xApolloCompile dep.apolloHttpCache
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.xiaofeng.android:flowlayoutmanager:1.2.3.2'
compile 'com.beloo.widget:ChipsLayoutManager:0.3.7#aar'
}
task downloadApolloSchema(type: DefaultTask, group: "GraphQL", description: "Download GraphQL store front API schema") {
doLast {
println("Downloading GraphQL schema...")
def schemaFile = new File(project.projectDir.absolutePath + '/src/xApollo/graphql/com/shopify/sample/domain/schema.json')
if (schemaFile.exists()) {
schemaFile.delete()
}
new URL('https://app.shopify.com/services/ping/storefront_graphql_schema').withInputStream { i ->
schemaFile.withOutputStream {
it << i
}
}
println("GraphQL schema has been downloaded!")
}
}
apollo {
customTypeMapping['URL'] = "String"
customTypeMapping['HTML'] = "String"
customTypeMapping['Money'] = "java.math.BigDecimal"
nullableValueType = "apolloOptional"
generateAccessors = false
useSemanticNaming = false
}

Project refresh failed - Error:Cause: org/gradle/internal/TrueTimeProvider

Importing this project from github, I've run into this message:
Gradle 'GameOfLife-master' project refresh failed
Error:Cause: org/gradle/internal/TrueTimeProvider
I've tried solutions posted here, cleaned/rebuilt (at least attempted to) the project, invalidated caches and tried a different version of Gradle. None of that worked. Anyone else got any ideas?
Module: app - build.gradle
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath "com.neenbedankt.gradle.plugins:android-apt:1.8"
classpath 'com.jakewharton.hugo:hugo-plugin:1.1.0'
classpath "net.rdrei.android.buildtimetracker:gradle-plugin:0.5.+"
classpath 'io.fabric.tools:gradle:1.+'
classpath 'hu.supercluster:paperwork-plugin:1.2.7'
}
}
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'io.fabric'
apply plugin: 'hugo'
apply plugin: "build-time-tracker"
apply plugin: 'hu.supercluster.paperwork'
paperwork {
set = [
gitInfo: gitInfo(),
gitSha: gitSha(),
buildTime: buildTime("yyyy-MM-dd HH:mm:ss", "GMT+01:00")
]
}
def versionMajor = 1
def versionMinor = 2
def versionPatch = 0
android {
compileSdkVersion androidCompileSdkVersion
buildToolsVersion androidBuildToolsVersion
defaultConfig {
applicationId 'hu.supercluster.gameoflife'
minSdkVersion androidMinSdkVersion
targetSdkVersion androidTargetSdkVersion
versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
signingConfigs {
alpha {}
beta {}
release {}
}
buildTypes {
debug {
applicationIdSuffix ".debug"
versionNameSuffix "-debug"
resValue "string", "app_name_for_buildtype", "Game of Life (debug)"
minifyEnabled false
testCoverageEnabled = false
}
alpha {
applicationIdSuffix ".alpha"
versionNameSuffix "-alpha"
resValue "string", "app_name_for_buildtype", "Game of Life (alpha)"
minifyEnabled false
testCoverageEnabled = false
lintOptions {
disable 'MissingTranslation'
}
}
beta {
applicationIdSuffix ".beta"
versionNameSuffix "-beta"
resValue "string", "app_name_for_buildtype", "Game of Life (beta)"
minifyEnabled false
testCoverageEnabled = false
}
release {
resValue "string", "app_name_for_buildtype", "Game of Life"
minifyEnabled false
proguardFile 'proguard-project.txt'
}
}
sourceSets.main {
// src/gen is the target for generated content like json model
java.srcDirs += 'build/generated/source/db'
}
// avoid errors with message 'Duplicate files copied in APK ...'
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
}
afterEvaluate {
def propsFile = rootProject.file('keystore.properties')
def configName = 'release'
if (propsFile.exists() && android.signingConfigs.hasProperty(configName)) {
def props = new Properties()
props.load(new FileInputStream(propsFile))
android.signingConfigs[configName].storeFile = rootProject.file(props['storeFile'])
android.signingConfigs[configName].storePassword = props['storePassword']
android.signingConfigs[configName].keyAlias = props['keyAlias']
android.signingConfigs[configName].keyPassword = props['keyPassword']
}
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:support-annotations:24.2.0'
compile 'com.android.support:support-v13:24.2.0'
compile 'com.android.support:support-v4:24.2.0'
// ---------
compile 'com.github.tslamic.adn:library:1.0'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') { transitive = true }
compile 'com.jakewharton.timber:timber:2.5.1'
compile 'com.squareup:otto:1.3.6'
compile 'hu.supercluster:paperwork:1.2.7'
// ---------
apt "org.androidannotations:androidannotations:" + androidAnnotationsVersion
compile("org.androidannotations:androidannotations-api:" + androidAnnotationsAPIVersion )
testCompile 'junit:junit:4.11'
testCompile 'org.mockito:mockito-core:1.9.5'
testCompile('com.squareup:fest-android:1.0.+') { exclude module: 'support-v4' }
testCompile "org.robolectric:robolectric:3.0"
androidTestCompile 'com.google.guava:guava:14.0.1',
'com.squareup.dagger:dagger:1.1.0',
'org.hamcrest:hamcrest-integration:1.1',
'org.hamcrest:hamcrest-core:1.1',
'org.hamcrest:hamcrest-library:1.1',
'com.jakewharton.espresso:espresso:1.1-r3'
}
apt {
arguments {
resourcePackageName android.defaultConfig.applicationId
androidManifestFile variant.outputs[0]?.processResources?.manifestFile
}
}
apply plugin: 'idea'
idea {
module {
//and some extra test source dirs
testSourceDirs += file('src/test')
}
}
apply from: 'build-time-tracker.gradle'
You could run with --stacktrace to get a full exception stack trace
Gradle has the concept of public API and private API. Basically anything in org.gradle.internal is a part of the private API and the gradle team can change / remove these classes between gradle versions. Ideally plugins should never reference internal classes. Any plugin author referencing internal API's must understand that this code may break with a new release of Gradle.
It looks like one of your plugins is referencing the internal API (org.gradle.internal.TrueTimeProvider) and the plugin was built against one version of Gradle and you are running with a different version of gradle.
To fix, you'll need to determine which plugin is throwing the exception (--stacktrace will help here). Then you'll either need to change the plugin version to one compatible with your version of gradle, or change the gradle version you are running with.

How do I use SVGs in android correctly?

I know that official support for SVG didn't start until api level 23, but how do I use it in an app with the min sdk at 17?
I have had it working before, and I don't know what changed. I am using AndroidSVG library.
I get this error when I try to build a production APK
Error:(163) Error: Expected resource of type drawable [ResourceType]
Here is one of the 150 lines of code that I get this error in
socialTypeImage.setImageResource(R.raw.icon_other_blue);
I don't know what other info to provide, so if you need more, please let me know.
Thanks
I don't know if my problem is a duplicate, but if it is, none of those solutions work.
buildscript {
repositories {
mavenCentral()
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
maven { url 'http://repository.codehaus.org' }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0-alpha1'
//classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.14.7'
classpath 'com.google.code.ksoap2-android:ksoap2-android:3.1.1'
classpath 'org.codehaus.groovy.modules.http-builder:http-builder:0.5.2'
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
maven { url "https://repo.commonsware.com.s3.amazonaws.com" }
maven { url "http://repository.codehaus.org" }
maven { url 'https://maven.fabric.io/public' }
}
import groovyx.net.http.HTTPBuilder
def getBuildNumber(projectName) {
def http = new HTTPBuilder('http://eco-crossbar-620.appspot.com')
try {
def resp = http.get(path: "/${projectName}")
println "NEW BUILD NUMBER: ${resp.BODY}"
resp.BODY
} catch (ignored) {
println "ERROR RETRIEVING BUILD NUMBER"
0
}
}
def getWorkingBranch() {
def workingBranch = "build"
try {
workingBranch = """git --git-dir=${rootDir}/.git
--work-tree=${rootDir}/
rev-parse --abbrev-ref HEAD""".execute().text.trim()
} catch (ignored) {
// git unavailable or incorrectly configured
}
println "Working branch: " + workingBranch
return workingBranch.replaceAll("/", "-")
}
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 23
buildToolsVersion '23.0.2'
def build = getBuildNumber("lookcounter-android")
defaultConfig {
applicationId "com.lookcounter"
minSdkVersion 17
targetSdkVersion 23
versionCode 67
versionName "0.1.$versionCode"
vectorDrawables.useSupportLibrary = true
buildConfigField "String", "DEFAULT_USERNAME", "\"\""
buildConfigField "String", "DEFAULT_PASSWORD", "\"\""
resValue "string", "base64_encoded_public_key", "key"
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "String", "DEFAULT_USERNAME", "\"\""
buildConfigField "String", "DEFAULT_PASSWORD", "\"\""
debuggable false
jniDebuggable false
renderscriptDebuggable false
pseudoLocalesEnabled false
}
debug {
minifyEnabled false
debuggable true
jniDebuggable true
renderscriptDebuggable true
pseudoLocalesEnabled true
zipAlignEnabled false
}
}
signingConfigs {
dev {
storeFile file("../LookCounter.keystore")
storePassword "izpa55word"
keyAlias "lookcounterkey"
}
prod {
storeFile file("../LookCounter.keystore")
keyAlias "lookcounterprodkey"
}
}
productFlavors {
production {
buildConfigField "boolean", "DEV_BUILD", "false"
resValue "string", "app_name", "Lookcounter"
signingConfig signingConfigs.prod
versionCode 2
minSdkVersion 17
targetSdkVersion 23
}
dev {
buildConfigField "boolean", "DEV_BUILD", "true"
resValue "string", "app_name", "(DEV) Lookcounter"
signingConfig signingConfigs.dev
applicationId 'com.lookcounter'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
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'
}
android.applicationVariants.all { variant ->
if (variant.buildType.name.equals("release")) {
variant.assemble.doLast {
def apkName
def dirName = System.getProperty("user.home") + "/Desktop/lookcounter/apk"
if (variant.name.contains("production")) {
dirName += "PlayStore"
apkName = "Lookcounter_v${versionCode}_PlayStore_${versionName}.apk"
} else {
dirName += "dev"
def branchName = getWorkingBranch()
if (branchName.equals("develop")) {
apkName = "Lookcounter_v${versionCode}_DEV_${build}.apk"
} else {
apkName = "Lookcounter_v${versionCode}_DEV_${branchName}_${build}.apk"
}
}
copy {
def source = variant.outputs.get(0).getOutputFile()
from source
into dirName
include source.name
rename source.name, apkName
println "Output APK copied to $dirName/$apkName"
}
}
}
}
}
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// compile "com.dev.sacot41:scviewpager:0.0.4"
compile project(':androidSVG')
compile files('../libraries/PriorityDeque-1.0.jar')
compile project(':cropper')
testCompile 'junit:junit:4.12'
// Possibly Keep
compile('com.doomonafireball.betterpickers:library:1.6.0') {
exclude group: 'com.android.support', module: 'support-v4'
}
// KEEP
compile('com.nostra13.universalimageloader:universal-image-loader:1.9.5') {
exclude group: 'com.android.support', module: 'support-v7'
}
compile('com.twitter.sdk.android:tweet-composer:0.7.3#aar') {
transitive = true;
}
compile('com.crashlytics.sdk.android:answers:1.3.6#aar') {
transitive = true;
}
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:support-v4:23.2.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.jakewharton:butterknife:5.1.2'
compile 'org.apache.commons:commons-lang3:3.1'
compile 'com.github.clans:fab:1.6.2'
compile 'com.facebook.android:facebook-android-sdk:3.21.1'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.google.code.ksoap2-android:ksoap2-android:3.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:support-vector-drawable:23.2.0'
compile 'com.android.support:animated-vector-drawable:23.2.0'
}
You can't use SVGs directly as a Resource. The Android resource loading system doesn't know what an SVG is. What you need to use is something like:
SVG svg = SVG.getFromResource(R.raw.icon_other_blue);
socialTypeImage.setImageDrawable(new PictureDrawable(svg.toPictureDrawable()));
Or you can use the SVGImageView widget class that is provided. Documentation here.

Gradle could not find manifest file

I am trying to build a project but I have the following error when I try to build it from command line:
error: Could not find the AndroidManifest.xml file, going up from path [C:\Users\User\Documents\work
space\app\app\app\build\generated\source\apt\debug] found using dummy file []
(max atempts: file:///C:/Users/User/Documents/workspace/app/app/app/build/generated/source/apt/debug/dummy1449680140847.java)
My manifest.xml is under the main foulder in the project structure.
and this is my gradle file:
import com.android.builder.core.DefaultManifestParser
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.ponideapps.recetapp"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// This is important, it will run lint checks but won't abort build
lintOptions {
abortOnError false
}
task srcZip(type: Zip) {
from projectDir
def manifestParser = new DefaultManifestParser()
def versionName = manifestParser.getVersionName(android.sourceSets.main.manifest.srcFile)
archiveName = "${project.name}-${versionName}.${extension}"
exclude 'build', 'gen', 'bin', '.DS_Store', '.settings', 'local.properties', '.gradle', '*.apk', '.idea', '*.iml', '*.log',
'*/build', "*/gen", "*/bin", '*/*.iml', '*/*.log'
}
assemble.dependsOn srcZip
}
allprojects {
repositories {
mavenCentral()
}
}
android.applicationVariants.all { variant ->
println "Defining task generate${variant.name.capitalize()}Javadoc"
task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) {
description "Generates Javadoc for $variant.name."
source = variant.javaCompile.source
//source = files()
//variant.sourceSets.each{ sourceSet ->
// sourceSet.javaDirectories.each{ javaDirectory ->
// //println("adding source dir for javadoc generation: " + javaDirectory)
// source += files(javaDirectory)
// }
//}
//source += files("$buildDir/generated/source/r/" + variant.dirName)
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
//why doesn't this help? This should add the classfiles for the apt & R files
//+ files("$buildDir/intermediates/classes/" + variant.dirName)
//this would allow markdown comments, however, the plugin seems to be broken and always claims it cannot write a file it has just written :(
//options.doclet = 'com.visural.doclets.markdown.standard.Standard'
//options.docletpath = ["./libs/MarkdownDoclet-3.0.jar"]
options.links("http://docs.oracle.com/javase/7/docs/api/", "http://www.joda.org/joda-time/apidocs/");
//this is necessary to create links to the android documentation: the android website does not
//contain the list necessary to create javadoc, the local installation does
options.linksOffline("http://d.android.com/reference", "${android.sdkDirectory}/docs/reference");
exclude '**/BuildConfig.java'
exclude '**/R.java'
options.memberLevel = JavadocMemberLevel.PROTECTED
//this is very much necessary, as the apt files & the R.class would otherwise break the javadoc
failOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
//android annotations
compile files('libs/androidannotations-api-3.0.1.jar')
apt files('libs_annotations/androidannotations-3.0.1.jar')
}
apt {
arguments {
resourcePackageName "com.ponideapps.recetapp"
}
}
Does someone where is the problem?
Thank you very much in advance!
Add this:
apt {
arguments {
resourcePackageName "com.ponideapps.recetapp"
androidManifestFile variant.outputs[0]?.processResources?.manifestFile
}
}

Exclude class from aar

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')
}

Categories

Resources