felHR85 / UsbSerial

Usb serial controller for Android
MIT License
1.81k stars 589 forks source link

ERROR: Failed to resolve: com.github.felHR85:UsbSerial:6.0.4 #309

Open Harshith996 opened 4 years ago

Harshith996 commented 4 years ago

I have added the following line to the gradle file: implementation 'com.github.felHR85:UsbSerial:6.0.4'

I have also included maven: repositories { google() jcenter() maven { url "https://jitpack.io" }

}

However, I am still getting the 'Failed to Resolve' error with whatever version I try. Please help me fix this issue.

sivaprashanth commented 4 years ago

Try the latest one which is 6.1.0

Harshith996 commented 4 years ago

Try the latest one which is 6.1.0

I tried that as well but same error. Is it because I din't include kotlin support?

sivaprashanth commented 4 years ago

if you are writing a kotlin language program then its necessary otherwise it is not.

this is my build gradle file - apply plugin: 'com.android.application'

android { compileSdkVersion 26 useLibrary 'org.apache.http.legacy' defaultConfig { applicationId "questron.com.v10" minSdkVersion 21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }

/ compileOptions { encoding "UTF-8" sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }/

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility = 1.8
    targetCompatibility = 1.8
}
buildToolsVersion = '25.0.2'

}

dependencies { implementation fileTree(dir: 'libs', include: ['achartengine-1.1.0.jar']) implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.13' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' //implementation 'com.github.mik3y:usb-serial-for-android:Tag' implementation 'com.github.felHR85:UsbSerial:6.1.0'

}

you can try this and check or try the examples to get an idea.

Harshith996 commented 4 years ago

Its still not working

mobilinkd commented 4 years ago

I am having the same problem. Failed to resolve: com.github.felHR85:UsbSerial:6.1.0

Changing the capitalization of the project and repo name to all lower case as shown on the jitpack.io page has no effect.

buildscript {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
...
dependencies {
    implementation 'org.scala-lang:scala-library:2.11.12'
    implementation 'com.github.felHR85:UsbSerial:6.1.0'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
}

It seems like there is some underlying dependency that is not being met. Is there some way to diagnose when Android Studio or Gradle is doing under the hood here to see what the actual error message returned when trying to resolve this package is?

mobilinkd commented 4 years ago

OK, so I found the issue that was affecting me. There are two places where I needed to specify the jitpack.io dependency. The second was here:

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}
mod157 commented 4 years ago

The same problem occurred and solved. Add'maven' as the answer above says Build OK In my case, it was only applied to the Module:Library part in'build.gradle', but I added'maven' to gradle: Proejct> repositories.

c

antonio-irarrazaval commented 2 years ago

After a lot of time, its works.... starting with clean project Android Studio 2020.3.1 , exacts Copy&Paste config files.

setting.gradle:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        // jcenter() // Warning: this repository is going to shut down soon
        maven { url 'https://jitpack.io' }
    }
}
rootProject.name = "Rephone9"
include ':app'

build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath "com.android.tools.build:gradle:7.0.2"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle (:app)

plugins {
    id 'com.android.application'
}

android {
    compileSdk 31

    defaultConfig {
        applicationId "com.rephone.rephone9"
        minSdk 21
        targetSdk 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:2.0.4'
    implementation 'com.github.felHR85:UsbSerial:6.1.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Malik056 commented 2 years ago

Just add this in settings.gradle file

maven { url 'https://jitpack.io' }

The settings.gradle file will look like this

repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
djhunter67 commented 2 months ago

This COMPILES error FREE

build.gradle.kts (:app)

dependencies {

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(libs.androidx.activity)
implementation(libs.androidx.constraintlayout)
implementation(libs.usbserial)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)

}

settings.gradle.kts (projectName)

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { setUrl("https://jitpack.io") }
    }
}

Conclusion

I have yet to see if the UsbSerial will work but it at least compiles.