I'm trying to use paho Mqtt's android client in android studio and using gradle to add dependencies, I use the following in app build.gradle:
repositories {
maven {
url "https://repo.eclipse.org/content/repositories/paho-releases/"
}
}
dependencies {
compile('org.eclipse.paho:org.eclipse.paho.android.service:1.0.2') {
exclude module: 'support-v4'
}
}
yet this is giving me failed to resolve error.I tried with SNAPSHOT version (1.0.3 and I got the same error. I've tried as many scripts as googling yielded to no result.
any help is greatly appreciated.
my refrence is :
http://www.hivemq.com/blog/mqtt-client-library-enyclopedia-paho-android-service
this is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.sayres.mqttapp"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url "https://repo.eclipse.org/content/repositories/paho-releases/"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile('org.eclipse.paho:org.eclipse.paho.android.service:1.0.2') {
exclude module: 'support-v4'
}
}
Remove this from your app build.gradle and added to project build.gradle by allprojects
repositories {
maven { url "https://repo.eclipse.org/content/repositories/paho-releases/" }
}
Related
I'm trying to build my Android Project but when I rebuild I receive this error message:
Could not find com.jakewharton:butterknife-compiler:5.1.2.
Searched in the following locations:
file:/C:/Android/android-sdk/extras/m2repository/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.pom
file:/C:/Android/android-sdk/extras/m2repository/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.jar
file:/C:/Android/android-sdk/extras/google/m2repository/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.pom
file:/C:/Android/android-sdk/extras/google/m2repository/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.jar
file:/C:/Android/android-sdk/extras/android/m2repository/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.pom
file:/C:/Android/android-sdk/extras/android/m2repository/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.jar
https://jcenter.bintray.com/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.pom
https://jcenter.bintray.com/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.jar
https://dl.google.com/dl/android/maven2/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.pom
https://dl.google.com/dl/android/maven2/com/jakewharton/butterknife-compiler/5.1.2/butterknife-compiler-5.1.2.jar
Required by:
project :app
This is my build.gradle module:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.wakeup.xxx"
minSdkVersion 18
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:25.1.1'
testImplementation 'junit:junit:4.12'
implementation 'com.jjoe64:graphview:4.2.2'
implementation 'com.jakewharton:butterknife:5.1.2'
annotationProcessor 'com.jakewharton:butterknife-compiler:5.1.2'
// https://mvnrepository.com/artifact/com.jakewharton/butterknife
}
buildscript {
repositories {
google() // <--here
}
}
allprojects {
repositories {
google() // <-- here
}
}
Can someone help me?
Your project :app is missing a butter knife reference. From the documentation this is what you are missing:
repositories {
mavenCentral()
}
Also, the version you are using 5.1.2 does not exists:
{ "errors" : [ {
"status" : 404,
"message" : "Could not find resource" } ] }
Try the following file:
apply plugin: 'com.android.application'
buildscript {
repositories {
google()
mavenCentral()
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
android {
compileSdkVersion 26
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.wakeup.xxx"
minSdkVersion 18
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:25.1.1'
testImplementation 'junit:junit:4.12'
implementation 'com.jjoe64:graphview:4.2.2'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
This is my build.gradle(app)
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' }
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.my.app"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
}
}
ant.importBuild 'assets.xml'
preBuild.dependsOn(list, checksum)
clean.dependsOn(clean_assets)
def dagger_version = "2.10"
def retrofit2_version = "2.2.0"
def support_package_version = "26.0.0-alpha1"
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//dagger
compile "com.google.dagger:dagger:${dagger_version}"
annotationProcessor "com.google.dagger:dagger-compiler:${dagger_version}"
//retrofit2
compile "com.squareup.retrofit2:retrofit:${retrofit2_version}"
compile "com.squareup.retrofit2:converter-jackson:${retrofit2_version}"
//okhttp3
//support packages
compile "com.android.support:appcompat-v7:${support_package_version}"
compile "com.android.support:cardview-v7:${support_package_version}"
compile "com.android.support:design:${support_package_version}"
compile project(':pocketsphinx-android-5prealpha-release')
compile 'pl.bclogic:pulsator4droid:1.0.3'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.android.support:support-annotations:25.3.1'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.0'
androidTestCompile 'com.android.support.test:runner:1.0.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
}
I have noted the controversial dependencies from here
And I get the following errors
Failed to resolve:com.android.support.test.espresso:espresso-core:3.0.0
Failed to resolve:com.android.support.test:runner:1.0.0
I have updated the sdk manager, but still facing this. Do I have to downgrade to a lower version?
Can anyone help?
I had the same problem when I wanted to try Espresso.
I've resolved it by adding
maven {
url "https://maven.google.com"
}
to
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
in the project's build.gradle file. See https://developer.android.com/topic/libraries/testing-support-library/packages.html#gradle-dependencies.
I have a react native project that was auto-generated by https://getexponent.com/ when I detached the project. Now I'm getting these build errors after I added react-native-lock with react native link. It works fine as an iOS project with xcode, but android studio is giving me this error:
Error:Execution failed for task ':app:processDebugResources'.
> Error: more than one library with package name 'com.facebook.react'
And the build.grade files
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '24.0.3'
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
defaultConfig {
applicationId "com.foo.app"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
ndk {
abiFilters 'armeabi-v7a', 'x86'
}
manifestPlaceholders = [
'appAuthRedirectScheme': 'com.foo.app'
]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "8g"
}
}
task exponentPrebuildStep(type: Exec) {
workingDir '../../'
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
commandLine 'cmd', '/c', '.\\.exponent-source\\android\\detach-scripts\\prepare-detached-build.bat'
} else {
commandLine './.exponent-source/android/detach-scripts/prepare-detached-build.sh'
}
}
preBuild.dependsOn exponentPrebuildStep
repositories{
flatDir{
dirs 'libs'
}
mavenLocal()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile project(':react-native-lock')
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:multidex:1.0.0'
compile('host.exp.exponent:exponentview:13.0.0#aar') {
exclude module: 'bolts-android'
transitive = true;
}
}
and for react-native-lock
repositories {
jcenter()
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion '24.0.3'
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "0.4.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
ext.libraries = [
testing: [
dependencies.create('junit:junit:4.11') {
exclude module: 'hamcrest-core'
},
'org.robolectric:robolectric:3.0-rc3',
'com.google.guava:guava:18.0',
'org.hamcrest:hamcrest-integration:1.3',
'org.hamcrest:hamcrest-core:1.3',
'org.hamcrest:hamcrest-library:1.3',
'org.mockito:mockito-core:1.10.19',
dependencies.create('com.squareup:fest-android:1.0.+') {
exclude group: 'com.android.support', module: 'support-v4'
},
'org.powermock:powermock-api-mockito:1.6.3',
'org.powermock:powermock-module-junit4-rule:1.6.3',
'org.powermock:powermock-classloading-xstream:1.6.3'
]
]
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:support-v4:23.+'
compile 'com.facebook.react:react-native:+'
compile 'com.auth0.android:lock:1.17.+'
compile 'com.auth0.android:lock-passwordless:1.17.+'
testCompile libraries.testing
}
Change build.gradle from
compile project(':react-native-lock')
to
compile(project(':react-native-lock')) { exclude module: 'react-native' }
As it is documented here: https://docs.getexponent.com/versions/v14.0.0/guides/exponentkit.html#make-native-changes
I have downloaded Kaltura SDK and integrated into my project, I got below error, but when I ran demo application, I could run it.
Error:Execution failed for task ':playerSDK:transformNative_libsWithSyncJniLibsForRelease'.
> java.io.FileNotFoundException: /Users/aaaa/AndroidWorkplace/MediaShare/playerSDK/build/intermediates/bundles/release/jni/lib/armeabi/libHLSPlayerSDK.so (No such file or directory)
This is my gradle file:
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' }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.aaaa.testSample"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "0.1"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/ASL2.0'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':playerSDK')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile ('org.apache.httpcomponents:httpmime:4.5'){
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#11sd') {
transitive = true;
}
compile files('libs/gson-2.2.4.jar')
}
Any support on this?
I can't find the url on maven too build my project.
My android studio gives the following error:
Error:com.mcxiaoke.volley:library:1.0.+ (double-click here to find usages.)
The whole build.gradle file
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.3'
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 100
versionName "1.00"
}
buildTypes {
release {
runProguard false
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
productFlavors {
defaultFlavor {
proguardFile 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
url 'http://clinker.47deg.com/nexus/content/groups/public'
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:support-v4:19.1.0'
compile 'com.google.android.gms:play-services:4.3.23'
compile 'joda-time:joda-time:2.3#jar'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.0'
compile 'com.j256.ormlite:ormlite-core:4.48#jar'
compile 'com.j256.ormlite:ormlite-android:4.48#jar'
compile 'com.loopj.android:android-async-http:1.4.5-SNAPSHOT'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile ('com.fortysevendeg.swipelistview:swipelistview:1.0-SNAPSHOT#aar') {
transitive = true
}
compile project(':libraries:facebook')
}
As you see in the file I added mavenCentral() to the dependencies but that didn't help.
Double check you have the right repository declaration in your build.gradle:
repositories {
mavenCentral()
}