Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] android build packaging could not resolve io.openim:core-sdk #27

Open
15975019972 opened this issue Nov 12, 2024 · 11 comments
Open

Comments

@15975019972
Copy link

OpenIM Server Version

3.7.1

Operating System and CPU Architecture

Linux (AMD)

Deployment Method

Source Code Deployment

Bug Description and Steps to Reproduce

Running 'gradlew :app:assembleRelease' in /home/expo/workingdir/build/android
Downloading https://services.gradle.org/distributions/gradle-8.3-all.zip
10%.
20%.
30%
40%.
50%
60%
70%.
80
%.
90%.
100%
Welcome to Gradle 8.3!
Here are the highlights of this release:

Task :gradle-plugin:settings-plugin:checkKotlinGradlePluginConfigurationErrors
Task :gradle-plugin:settings-plugin:pluginDescriptors
Task :gradle-plugin:settings-plugin:processResources
Task :gradle-plugin:settings-plugin:compileKotlin
Task :gradle-plugin:settings-plugin:compileJava NO-SOURCE
Task :gradle-plugin:settings-plugin:classes
Task :gradle-plugin:settings-plugin:jar
Task :gradle-plugin:react-native-gradle-plugin:checkKotlinGradlePluginConfigurationErrors
Task :gradle-plugin:react-native-gradle-plugin:pluginDescriptors
Task :gradle-plugin:react-native-gradle-plugin:processResources
Task :gradle-plugin:react-native-gradle-plugin:compileKotlin
Task :gradle-plugin:react-native-gradle-plugin:compileJava NO-SOURCE
Task :gradle-plugin:react-native-gradle-plugin:classes
Task :gradle-plugin:react-native-gradle-plugin:jar
Configure project :expo-modules-core
Warning: Errors during XML parse:
Warning: Additionally, the fallback loader failed to parse the XML.
Checking the license for package NDK (Side by side) 27.1.12297006 in /home/expo/Android/Sdk/licenses
License for package NDK (Side by side) 27.1.12297006 accepted.
Preparing "Install NDK (Side by side) 27.1.12297006 v.27.1.12297006".
"Install NDK (Side by side) 27.1.12297006 v.27.1.12297006" ready.
Installing NDK (Side by side) 27.1.12297006 in /home/expo/Android/Sdk/ndk/27.1.12297006
"Install NDK (Side by side) 27.1.12297006 v.27.1.12297006" complete.
"Install NDK (Side by side) 27.1.12297006 v.27.1.12297006" finished.
Configure project :expo
Using expo modules

  • expo-asset (10.0.10)
  • expo-barcode-scanner (13.0.1)
  • expo-blur (13.0.2)
  • expo-clipboard (6.0.3)
  • expo-constants (16.0.2)
  • expo-file-system (17.0.1)
  • expo-font (12.0.10)
  • expo-image (1.12.15)
  • expo-image-loader (4.7.0)
  • expo-image-picker (15.0.7)
  • expo-keep-awake (13.0.2)
  • expo-linear-gradient (13.0.2)
  • expo-location (17.0.1)
  • expo-modules-core (1.12.24)
  • expo-splash-screen (0.27.5)
  • expo-system-ui (3.0.7)
  • expo-web-browser (13.0.3)

Configure project :react-native-reanimated
Android gradle plugin: 8.2.1
Gradle: 8.3
FAILURE:
Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ':app:lintVitalReportRelease'.

Could not resolve all task dependencies for configuration ':app:releaseRuntimeClasspath'.
Could not resolve io.openim:core-sdk:3.8.1-rc.0.
Required by:
project :app > project :open-im-sdk-rn
> Could not resolve io.openim:core-sdk:3.8.1-rc.0.
> Could not get resource 'https://open-im-online.rentsoft.cn:51000/repository/maven2/io/openim/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom'.
> Could not GET 'https://open-im-online.rentsoft.cn:51000/repository/maven2/io/openim/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom'.

Connect to open-im-online.rentsoft.cn:51000 [open-im-online.rentsoft.cn/43.154.157.177] failed: Connect timed out

  • Try:

Run with
--stacktrace
option to get the stack trace.

Run with
--info
or
--debug
option to get more log output.

Run with --scan to get full insights.

Get more help at https://help.gradle.org.
BUILD FAILED in 3m 53s
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
10 actionable tasks: 10 executed
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

image

Screenshots Link

https://open-im-online.rentsoft.cn:51000/repository/maven2/

@15975019972
Copy link
Author

根据错误日志,构建失败的主要原因是无法下载 io.openim:core-sdk:3.8.1-rc.0 依赖项,具体表现为连接超时(Connect timed out)。这是由于构建过程中访问 https://open-im-online.rentsoft.cn:51000/repository/maven2 的请求没有成功,可能是由于网络问题或目标服务器不响应。

以下是一些可能的解决方案:

1.	检查网络连接:确保构建环境可以访问外部网络,尤其是 open-im-online.rentsoft.cn 这个域名。如果这是在CI环境(如Expo的构建服务器)中构建,可能需要检查该环境是否有防火墙或网络限制。
2.	手动下载依赖:可以尝试将该依赖手动下载到本地仓库中,然后再执行构建。不过这通常适用于开发环境,对于CI构建可能不太适用。
3.	更换依赖源:检查 open-im 是否有其他可用的Maven仓库源。如果有,可以在 build.gradle 中配置一个备用的Maven源。
4.	延长网络超时:可以尝试在Gradle的 build.gradle 中配置长一些的网络超时时间,例如:

@lgz5689 lgz5689 changed the title [BUG] android构建打包错误 [BUG] android build packaging error Nov 12, 2024
@lgz5689
Copy link
Member

lgz5689 commented Nov 13, 2024

Try removing the following code, because it has recently migrated to mavenCentral()

maven {
    allowInsecureProtocol = true
    url 'https://open-im-online.rentsoft.cn:51000/repository/maven2/'
}

@15975019972
Copy link
Author

我需要怎么配置?

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = findProperty('android.buildToolsVersion') ?: '34.0.0' // 或者使用 '33.0.0',根据你需要的版本
minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '23') // 设置为21
compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '34') // 使用33
targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34') // 使用33
kotlinVersion = findProperty('android.kotlinVersion') ?: '1.9.23'

    // 使用需要的NDK版本
    ndkVersion = "27.1.12297006"
}
repositories {
    google()
    mavenCentral()
}
dependencies {
    classpath('com.android.tools.build:gradle')
    classpath('com.facebook.react:react-native-gradle-plugin')
    classpath('org.jetbrains.kotlin:kotlin-gradle-plugin')
}

}

apply plugin: "com.facebook.react.rootproject"

allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android'))
}
maven {
// Android JSC is installed from npm
url(new File(['node', '--print', "require.resolve('jsc-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), '../dist'))
}

    google()
    mavenCentral()
    maven { url 'https://www.jitpack.io' }
}

}

dependencies {
implementation 'io.openim:core-sdk:3.8.1-rc.0'
}

@15975019972
Copy link
Author

以下是报错信息
FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ':app:buildReleasePreBundle'.

Could not resolve all task dependencies for configuration ':app:releaseRuntimeClasspath'.
Could not find io.openim:core-sdk:3.8.1-rc.0.
Searched in the following locations:
- https://oss.sonatype.org/content/repositories/snapshots/io/openim/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
- https://repo.maven.apache.org/maven2/io/openim/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
- file:/Users/jianweiguan/Desktop/app/chaoyu-app-rn/node_modules/jsc-android/dist/io/openim/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
- https://dl.google.com/dl/android/maven2/io/openim/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
- https://www.jitpack.io/io/openim/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
- file:/Users/jianweiguan/Desktop/app/chaoyu-app-rn/node_modules/react-native/android/io/openim/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
Required by:
project :app > project :open-im-sdk-rn

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 17s
10 actionable tasks: 2 executed, 8 up-to-date

@lgz5689
Copy link
Member

lgz5689 commented Nov 13, 2024

Try removing the following code, because it has recently migrated to mavenCentral()

maven {
    allowInsecureProtocol = true
    url 'https://open-im-online.rentsoft.cn:51000/repository/maven2/'
}

Go to node_modules and remove all maven dependencies from the SDK, and remove all maven dependencies from the APP code. Since mavenCentral() is already used by default, you don't need to add new dependencies.

@15975019972
Copy link
Author

这好像是core-sdk-3.8.1-rc.0 下载错误,点击链接没有访问,需要怎么解决
FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ':app:buildReleasePreBundle'.

Could not resolve all task dependencies for configuration ':app:releaseRuntimeClasspath'.
Could not find io.openim:core-sdk:3.8.1-rc.0.
Searched in the following locations:
- https://oss.sonatype.org/content/repositories/snapshots/io/openim/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
- https://repo.maven.apache.org/maven2/io/openim/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
- file:/Users/jianweiguan/Desktop/app/chaoyu-app-rn/node_modules/jsc-android/dist/io/openim/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
- https://dl.google.com/dl/android/maven2/io/openim/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
- https://www.jitpack.io/io/openim/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
- file:/Users/jianweiguan/Desktop/app/chaoyu-app-rn/node_modules/react-native/android/io/openim/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
Required by:
project :app > project :open-im-sdk-rn
Could not find com.github.OpenIMSDK.Open-IM-SDK-Android:core-sdk:3.8.1-rc.0.
Searched in the following locations:
- https://oss.sonatype.org/content/repositories/snapshots/com/github/OpenIMSDK/Open-IM-SDK-Android/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
- https://repo.maven.apache.org/maven2/com/github/OpenIMSDK/Open-IM-SDK-Android/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
- file:/Users/jianweiguan/Desktop/app/chaoyu-app-rn/node_modules/jsc-android/dist/com/github/OpenIMSDK/Open-IM-SDK-Android/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
- https://dl.google.com/dl/android/maven2/com/github/OpenIMSDK/Open-IM-SDK-Android/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
- https://www.jitpack.io/com/github/OpenIMSDK/Open-IM-SDK-Android/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
- file:/Users/jianweiguan/Desktop/app/chaoyu-app-rn/node_modules/react-native/android/com/github/OpenIMSDK/Open-IM-SDK-Android/core-sdk/3.8.1-rc.0/core-sdk-3.8.1-rc.0.pom
Required by:
project :app > project :open-im-sdk-rn

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 18s

@15975019972
Copy link
Author

以下是node_module andorid的配置
buildscript {
// if (project == rootProject) {
repositories {
google()
mavenCentral()
}

    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.0'
    }
// }

}

apply plugin: 'com.android.library'

def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

android {
compileSdkVersion safeExtGet('OpenImSdkRn_compileSdkVersion', 33)
defaultConfig {
minSdkVersion safeExtGet('OpenImSdkRn_minSdkVersion', 16)
targetSdkVersion safeExtGet('OpenImSdkRn_targetSdkVersion', 33)
versionCode 1
versionName "1.0"

}

buildTypes {
    release {
        minifyEnabled false
    }
}
lintOptions {
    disable 'GradleCompatible'
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

}

repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
google()
mavenCentral()
jcenter()
}

dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'androidx.collection:collection:1.1.0'
implementation 'com.alibaba:fastjson:1.1.72.android'
implementation 'io.openim:core-sdk:3.8.1-rc.0@aar'
// implementation fileTree(dir: 'libs', include: ['.aar', '.jar'], exclude: [])
implementation 'com.github.OpenIMSDK.Open-IM-SDK-Android:core-sdk:3.8.1-rc.0'
}

allprojects {
repositories {
google()
mavenCentral()
maven { url "https://www.jitpack.io" }
}
}

/

@lgz5689 lgz5689 changed the title [BUG] android build packaging error [BUG] android build packaging could not resolve io.openim:core-sdk Nov 13, 2024
@lgz5689
Copy link
Member

lgz5689 commented Nov 13, 2024

Some older versions were removed during the migration, please check the repository to determine which versions are currently available.

@15975019972
Copy link
Author

怎么替换这些镜像源?

@15975019972
Copy link
Author

具体怎么操作

@lgz5689
Copy link
Member

lgz5689 commented Nov 14, 2024

Try removing the following code, because it has recently migrated to mavenCentral()

maven {
    allowInsecureProtocol = true
    url 'https://open-im-online.rentsoft.cn:51000/repository/maven2/'
}

Install the latest version and remove these dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants