Java

無法解決:java-ipfs-http-client:1.3.3

  • October 28, 2022

我正在嘗試為 Java 實現 IPFS,但遇到了“ Failed to resolve: com.github.ipfs:1.3.3’”錯誤

build.gradle 文件

在這裡我添加了實現’java-ipfs-http-client:1.3.3

plugins {
       id 'com.android.application'
   }
   
   android {
       compileSdk 32
       compileOptions {
           sourceCompatibility JavaVersion.VERSION_1_8
           targetCompatibility JavaVersion.VERSION_1_8
       }
       defaultConfig {
           applicationId "com.kornerz.web3kornerzapptest"
           minSdk 24
           targetSdk 32
           versionCode 1
           versionName "1.0"
   
           testInstrumentationRunner "androidx.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
       }
       buildFeatures {
           viewBinding true
       }
   }
   
   dependencies {
       implementation 'java-ipfs-http-client:1.3.3'
   
       implementation 'androidx.appcompat:appcompat:1.5.1'
       implementation 'com.google.android.material:material:1.7.0'
       implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
       implementation 'androidx.navigation:navigation-fragment:2.5.3'
       implementation 'androidx.navigation:navigation-ui:2.5.3'
       testImplementation 'junit:junit:4.13.2'
       androidTestImplementation 'androidx.test.ext:junit:1.1.3'
       androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
   }

settings.gradle file

在這裡我添加了 ’ maven { url ‘https://jitpack.io’ }

pluginManagement {
       repositories {
           gradlePluginPortal()
           google()
           mavenCentral()
           maven { url 'https://jitpack.io' }
       }
   }
   dependencyResolutionManagement {
       repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
       repositories {
           google()
           mavenCentral()
       }
   }
   rootProject.name = "testApplication"
   include ':app'

你有錯誤的依賴格式。改變這個:

implementation 'java-ipfs-http-client:1.3.3'

對此:

implementation 'com.github.ipfs:java-ipfs-http-client:1.3.3'

引用自:https://ethereum.stackexchange.com/questions/138286