Building android studio module fails to find the package as dependency - android

I've imported a module to android studio from eclipse and when I want to import a class from this module, the build fails with this error message:
/home/matias/workspace/Apps/app/src/main/java/io/example/app/MainActivity.java:8: error: package com.example.components.activities does not exist
import com.example.components.activities.AndroidVideoCapture;
^
1 error
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
The module components builds successfully (using 'Build > Make Module 'components'), the problem shows up when I try to build the app (again, 'Build > Make Module 'app').
here's the app build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "io.example.app"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:22.+'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(":components")
}
and the components build.gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 9
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-components.txt'
}
}
aaptOptions {
cruncherEnabled true
}
}
dependencies {
compile files('libs/amazon-ads-5.1.153.jar')
compile files('libs/amazon-device-messaging-1.0.1.jar')
compile project(':librarylvl')
compile project(':crop_lib')
compile project(':openGLVideoRenderer')
compile project(':libffmpeg')
//compile 'com.android.support:appcompat-v7:22.+'
compile 'com.google.android.gms:play-services:+'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.github.bumptech.glide:volley-integration:1.3.0'
compile 'com.mcxiaoke.volley:library:1.0.18'
compile 'com.getbase:floatingactionbutton:1.10.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.android.support:cardview-v7:22.0.+'
compile 'com.android.support:recyclerview-v7:22.0.+'
compile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
// change this 2 lines for release code
//compile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
//compile project(':nop-leakcanary')
}
so.. What is happening here? I'm missing some configurations or steps?
Note: if I import com.example.components.activities.* gradle fails to find the package, but I can import com.example.openglvideorenderer.RenderView just fine from the openGLVideoRenderer module.

Related

I am getting this error "Execution failed for task ':app:compileDebugJavaWithJavac'."

Error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Get more help at gradle.org
BUILD FAILED in 54s79 actionable tasks: 79 executed
Here is my build.gradle. Any help?
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.tclm.app"
minSdkVersion 16
targetSdkVersion 26
versionCode 4
versionName "1.3"
vectorDrawables.useSupportLibrary = true
resConfigs "auto"
manifestPlaceholders = [onesignal_app_id : "01bab543-cce8-4e36-a755-6bc23fd66b7c",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
multiDexEnabled true
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.mikepenz:fastadapter:2.6.3#aar') {
transitive = true
}
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:cardview-v7:26.0.2'
compile 'com.android.support:support-v4:26.0.2'
compile 'com.android.support:animated-vector-drawable:26.0.2'
compile 'com.android.support:design:26.0.2'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.synnapps:carouselview:0.1.4'
compile 'com.mikepenz:fastadapter-commons:2.6.3#aar'
compile 'com.mikepenz:fastadapter-extensions:2.6.3#aar'
compile 'com.miguelcatalan:materialsearchview:1.4.0'
compile 'org.jsoup:jsoup:1.10.3'
compile 'com.thefinestartist:finestwebview:1.2.7'
compile 'com.github.chrisbanes:PhotoView:1.3.1'
compile 'com.fnp:material-preferences:0.1.4'
compile 'com.thebluealliance:spectrum:0.7.1'
compile 'com.firebaseui:firebase-ui-auth:2.3.0'
compile 'com.google.firebase:firebase-messaging:11.2.2'
compile 'com.google.firebase:firebase-crash:11.2.2'
compile 'com.google.firebase:firebase-invites:11.2.2'
compile 'com.google.firebase:firebase-ads:11.2.2'
compile 'com.google.firebase:firebase-auth:11.2.2'
compile 'com.google.firebase:firebase-core:11.2.2'
compile 'com.google.android.gms:play-services-auth:11.2.2'
compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'
compile 'com.android.support:multidex:1.0.1'
// Required only if Facebook login support is required
compile('com.facebook.android:facebook-android-sdk:4.22.1')
// Required only if Twitter login support is required
compile("com.twitter.sdk.android:twitter-core:3.0.0#aar") { transitive = true }
}
apply plugin: 'com.google.gms.google-services'

android - could not find support-annotations.jar

I'm trying to sync project with Gradle. But gradle gives some error.
The error code like this : Error:A problem occurred configuring project ':app'.
Could not find support-annotations.jar (com.android.support:support-annotations:24.0.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-annotations/24.0.0/support-annotations-24.0.0.jar
My build.gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
repositories {
mavenCentral()
}
defaultConfig {
applicationId "com.example.ileem.tiiu"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0-alpha2'
compile 'com.android.support:design:24.0.0-alpha2'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.maps.android:android-maps-utils:0.4'
compile 'com.google.firebase:firebase-messaging:9.6.1'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile files('libs/gson-2.2.4.jar')
compile files('libs/jsoup-1.10.1.jar')
}
apply plugin: 'com.google.gms.google-services'
Try upgrading to the latest version of the build tools and support libraries. You can find them here.

Persistent error -Execution failed for task ':app:transformClassesWithJarMergingForDebug'

I am trying to add microsoft azure mobile services to my existing android app. After adding the .jar files in my folder. I am getting error:
Execution failed for task
':app:transformClassesWithJarMergingForDebug.
For various file like annotation.class, Gson$5.class and as you can see in the error file it shows ApiJsonOperationCallback.class.
I have tired a lot of things(such as ./gradlew clean and ./gradlew clean assemble) but have been running into deadends everywhere.
This is my gradle file
apply plugin: 'com.android.application'
android {compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.jino.navigationplacepicker"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
defaultConfig {
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildscript {
repositories {
jcenter()
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3'
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3-javadoc.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3-sources.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/gson-2.2.2.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/guava-17.0.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3.jar')
}
And this is the error message
:app:compileDebugNdk UP-TO-DATE :app:compileDebugSources
:app:transformClassesWithJarMergingForDebug FAILED Error:Execution
failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
com/microsoft/windowsazure/mobileservices/ApiJsonOperationCallback.class
:app:compileDebugJavaWithJavac Note: Some input files use or override
a deprecated API. Note: Recompile with -Xlint:deprecation for details.
Information:BUILD FAILED
Request you to please into this, and respond in layman terms as i am new to this.
The libraries are referenced twice in the gradle file causing them to conflict with each other.
The following lines are not needed.
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3-javadoc.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3-sources.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/gson-2.2.2.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/guava-17.0.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3.jar')
The following line will download and reference the needed binaries for Azure Mobile Services.
compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3'
Here is a copy of a gradle file for a working Android application.
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.example.yourapp"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
flatDir {
dirs 'aars'
}
}
}
dependencies {
compile 'com.google.code.gson:gson:2.3'
compile 'com.google.guava:guava:18.0'
compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3'
}

Android Studio: Execution fails when I add SignalR client library

I have downloaded signalr client library from https://github.com/SignalR/java-client. On build it generated jar files.
When I add the jar files to my project, the project builds but when I try to run I get the error message below:
Error:Execution failed for task ':app:dexDebug'.> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_25\bin\java.exe'' finished with non-zero exit value 1
Previously I followed the tutorial on https://whathecode.wordpress.com/2014/03/20/getting-started-with-the-java-signalr-sdk/ and downloaded jar files from https://www.mediafire.com/?8qun6hbs3onnbbl. Those jar files were working fine.
However I needed the WebSocket transport protocol which were implemented in the latest version.
I am not sure if removal of previous jar files causing any issues.
Gradle scripts:
signalr-client-sdk
apply plugin: 'java'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.2.2'
compile 'org.java-websocket:java-websocket:1.3.1'
}
-signalr-client-sdk-android
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 8
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
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:21.0.3'
compile project(':signalr-client-sdk')
}
-My project
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "com.eb5.uvexa.uvexadriver"
minSdkVersion 17
targetSdkVersion 21
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions
{
preDexLibraries=false
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile files('libs/gson-2.2.2.jar')
compile files('libs/mail.jar')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/signalr-client-sdk.jar')
compile files('libs/signalr-client-sdk-android.jar')
}
I tried clean and rebuild, restarted the pc and also Invalidate option in Android Studio.
I am using windows10 and Android Studio(64). What am I doing wrong?

Error: more than one library with package name

The Android-studio post a Error
Error:Execution failed for task ':android:processDebugResources'.
Error: more than one library with package name 'com.tencent.weibo.sdk.android.component'
You can temporarily disable this error with android.enforceUniquePackageName=false
However, this is temporary and will be enforced in 1.0
Below is my content of build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.insthub.ecmobile"
minSdkVersion 8
targetSdkVersion 17
testApplicationId "com.insthub.ecmobile.test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':androidSDK')
compile project(':alipay_lib')
compile project(':eventBus')
compile 'com.android.support:support-v4:19.1.0'
compile files('libs/Msc.jar')
compile files('libs/UPPayAssistEx.jar')
compile files('libs/UPPayPluginExPro.jar')
compile files('libs/alipay.jar')
compile files('libs/commons-httpclient-3.0.1.jar')
compile files('libs/libammsdk.jar')
compile files('libs/pushservice-3.2.0.jar')
compile files('libs/umeng_sdk.jar')
compile files('libs/universal-image-loader-1.8.6-with-sources.jar')
compile files('libs/weibosdkcore.jar')
compile project(':androidSDKComponent')
}
I can't find "com.tencent.weibo.sdk.android.component"

Categories

Resources