我正在尝试在我的反应本机应用程序上渲染全景图像。尝试了几个软件包,但大多数开发人员都建议这样做https://github.com/lightbasenl/react-native-panorama-view。
此后,我对包的 build.gradlew 进行了一些更改。我无法构建该应用程序。有没有办法解决这个问题
build.gradle(应用程序)
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(反应原生全景视图)
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' }
}
原因:因为他们已经删除了它,因为 jcenter 不再活跃,但它可以作为只读存储库访问。
注意:此https://github.com/lightbasenl/react-native-panorama-view库将不再更新并现已存档。