我正在try 在我的react-native应用程序上渲染panaroma图像.try 了几个包,但大多数开发人员都建议使用这https://github.com/lightbasenl/react-native-panorama-view个包.

从那时起,我对包的Build.gradlew进行了一些更改.我无法构建该应用程序.有没有办法解决这个问题

build.gradle (app)

buildscript {
    ext {
        buildToolsVersion = "34.0.0"
        minSdkVersion = 23
        compileSdkVersion = 34
        targetSdkVersion = 34
        ndkVersion = "26.1.10909125"
        kotlinVersion = "1.9.22"
    }
    repositories {
        flatDir {
            dirs 'libs'
        }
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
    }
}

subprojects { subproject ->
    if(project['name'] == 'lightbase_react-native-panorama-view'){
        project.configurations { compile { } }
    }
}

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

build.gradle (react-native-panorama-view)

buildscript {
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        // Matches recent template from React Native (0.59)
        // https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L16
        classpath 'com.android.tools.build:gradle:3.3.2'
    }
}

apply plugin: 'com.android.library'
apply plugin: 'maven-publish'

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

// Matches values in recent template from React Native (0.59)
// https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L5-L9
def DEFAULT_COMPILE_SDK_VERSION = 28
def DEFAULT_BUILD_TOOLS_VERSION = "28.0.3"
def DEFAULT_MIN_SDK_VERSION = 19
def DEFAULT_TARGET_SDK_VERSION = 28

android {
  compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
  buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)

  defaultConfig {
    minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
    targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
    versionCode 1
    versionName "1.0"
  }
  lintOptions {
    abortOnError false
  }
}

repositories {
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        // Matches recent template from React Native (0.59)
        // https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L30
        url "$projectDir/../node_modules/react-native/android"
    }
    mavenCentral()
}

dependencies {
    implementation 'com.facebook.react:react-native:+'
    // Panorama
    implementation "androidx.annotation:annotation:1.1.0"
    implementation 'com.google.vr:sdk-base:1.180.0'
    implementation 'com.google.vr:sdk-common:1.180.0'
    implementation 'com.google.vr:sdk-commonwidget:1.180.0'
    implementation 'com.google.vr:sdk-panowidget:1.180.0'
    implementation 'commons-io:commons-io:2.5'
}

def configureReactNativePom(def pom) {
    def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)

    pom.project {
        name packageJson.title
        artifactId packageJson.name
        version = packageJson.version
        group = "nl.lightbase"
        description packageJson.description
        url packageJson.repository.baseUrl

        licenses {
            license {
                name packageJson.license
                url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
                distribution 'repo'
            }
        }

        developers {
            developer {
                id packageJson.author.username
                name packageJson.author.name
            }
        }
    }
}

afterEvaluate { project ->
    // some Gradle build hooks ref:
    // https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
    task androidJavadoc(type: Javadoc) {
        source = android.sourceSets.main.java.srcDirs
        classpath += files(android.bootClasspath)
        classpath += files(project.getConfigurations().getByName('compile').asList())
        include '**/*.java'
    }

    task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
        archiveClassifier  = 'javadoc'
        from androidJavadoc.destinationDir
    }

    task androidSourcesJar(type: Jar) {
        archiveClassifier  = 'sources'
        from android.sourceSets.main.java.srcDirs
        include '**/*.java'
    }

    android.libraryVariants.all { variant ->
        def name = variant.name.capitalize()
        def javaCompileTask = variant.javaCompileProvider.get()

        task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
            from javaCompileTask.destinationDir
        }
    }

    artifacts {
        archives androidSourcesJar
        archives androidJavadocJar
    }

    task installArchives(type: Upload) {
        configuration = configurations.archives
        repositories{
            mavenDeployer {
                repository url: "file://${projectDir}/../android/maven"
                configureReactNativePom pom
            }}
    }
}

推荐答案

在Gradle文件中添加jcenter()此行

//.....

buildscript {
    ext {
        buildToolsVersion = "34.0.0"
        minSdkVersion = 23
        compileSdkVersion = 34
        targetSdkVersion = 34
        ndkVersion = "26.1.10909125"
        kotlinVersion = "1.9.22"
    }
    repositories {
        flatDir {
            dirs 'libs'
        }
        google()
        jcenter()
        mavenCentral()
    }

//.....


allprojects {   
    repositories {      
        mavenCentral()
        mavenLocal()    

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

原因:因为他们有removed it个,因为jcenter不再活跃,但它可以作为只读存储库访问.

Note : This 100 library will no longer updated and now archived.

Ios相关问答推荐

如何在SwiftUI ScrollView中zoom 中心项目?

与iPadOS中带有扣件的模式相似的组件是什么?

如何在SwiftUI中扩展双击的可检测区域?

在金属中设置纹理的UV坐标以编程方式变形纹理

GraphQL iOS Apollo客户端自动持久化查询导致崩溃

swiftui动画如何实时确定不对称过渡

RFID scanner 的蓝牙服务 UUID?

如何结合`@dynamicMemberLookup`和`ExpressibleByStringInterpolation`来实现方法链?

比较 `某个协议` 实例时出现编译错误

为什么 Firebase Messaging 配置对于 IOS native 和 Flutter iOS 不同?

从iOS键盘输入时Flutter TextField输入消失

在标签中显示多个计数器但在同一屏幕(Swift,IOS)

渲染的海边重定向在物理 iOS 设备上不起作用

SwiftUI - ScrollView 不显示底部文本

Xcode 14 弃用了位码 - 但为什么呢?

在 Swift 中为 UITextField/UIView 摇动动画

UILabel - 字符串作为文本和链接

快速禁用 UITextfield 的用户输入

命令 /Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang 失败,退出代码为 1

Swift - 获取设备的 WIFI IP 地址