Could not resolve all files for configuration ':_internal_prefab_binary'.
Issue Description:
Could not resolve all files for configuration ':_internal_prefab_binary'. Cannot resolve external dependency com.google.prefab:cli:2.0.0 because no repositories are defined. Required by: project :
Hello Team,
Please check this issue, coming from the latest update of [email protected]
I have researched this issue and found that it is an existing issue of google-issue-tracker.
Link:
(i) https://issuetracker.google.com/issues/265544858 (ii) https://issuetracker.google.com/issues/221231432
Previously I have also had those issues, and then after making some changes, I have reached this point.
Thanks for your concern regarding the matter :)
I have made some changes to the build. gradle file, but it does not effect much. Let me share this also.
import java.nio.file.Paths
buildscript {
repositories {
google()
mavenLocal()
mavenCentral()
maven { url 'https://www.jitpack.io' }
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.2"
}
}
allprojects {
repositories {
google()
mavenLocal()
mavenCentral()
maven { url 'https://www.jitpack.io' }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$projectDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$projectDir/../node_modules/jsc-android/dist")
}
}
}
def getExtOrDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["Worklets_" + name]
}
def getExtOrIntegerDefault(name) {
return getExtOrDefault(name).toInteger()
}
def isNewArchitectureEnabled() {
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
}
static def findNodeModules(baseDir) {
def basePath = baseDir.toPath().normalize()
// Node's module resolution algorithm searches up to the root directory,
// after which the base path will be null
while (basePath) {
def nodeModulesPath = Paths.get(basePath.toString(), "node_modules")
def reactNativePath = Paths.get(nodeModulesPath.toString(), "react-native")
if (nodeModulesPath.toFile().exists() && reactNativePath.toFile().exists()) {
return nodeModulesPath.toString()
}
basePath = basePath.getParent()
}
throw new GradleException("react-native-worklets-core: Failed to find node_modules/ path!")
}
def JS_RUNTIME = {
// Override JS runtime with environment variable
if (System.getenv("JS_RUNTIME")) {
return System.getenv("JS_RUNTIME")
}
// Check if Hermes is enabled in app setup
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
if (appProject?.hermesEnabled?.toBoolean()) {
return "hermes"
}
// Use JavaScriptCore (JSC) by default
return "jsc"
}.call()
def nodeModules = findNodeModules(projectDir)
def reactNativeArchitectures() {
def value = project.getProperties().get("reactNativeArchitectures")
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}
apply plugin: "com.android.library"
if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}
task prepareHeaders(type: Copy) {
from fileTree('../cpp').filter { it.isFile() }
into "${project.buildDir}/headers/rnworklets/react-native-worklets-core/"
includeEmptyDirs = false
}
task deleteCmakeCache() {
doFirst {
delete "${projectDir}/.cxx"
}
}
android {
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
defaultConfig {
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
externalNativeBuild {
cmake {
arguments "-DANDROID_STL=c++_shared",
"-DANDROID_TOOLCHAIN=clang",
"-DREACT_NATIVE_DIR=${nodeModules}/react-native",
"-DJS_RUNTIME=${JS_RUNTIME}"
abiFilters (*reactNativeArchitectures())
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
buildTypes {
debug {
externalNativeBuild {
cmake {
if (JS_RUNTIME == "hermes") {
arguments "-DHERMES_ENABLE_DEBUGGER=1"
} else {
arguments "-DHERMES_ENABLE_DEBUGGER=0"
}
}
}
}
release {
externalNativeBuild {
cmake {
arguments "-DHERMES_ENABLE_DEBUGGER=0"
}
}
}
}
sourceSets {
main {
if (isNewArchitectureEnabled()) {
java.srcDirs += ["src/newarch"]
} else {
java.srcDirs += ["src/oldarch"]
}
}
}
packagingOptions {
excludes = [
"META-INF",
"META-INF/**",
"**/libc++_shared.so",
"**/libfbjni.so",
"**/libjsi.so",
"**/libfolly_json.so",
"**/libfolly_runtime.so",
"**/libglog.so",
"**/libhermes.so",
"**/libhermes-executor-debug.so",
"**/libhermes_executor.so",
"**/libreactnativejni.so",
"**/libturbomodulejsijni.so",
"**/libreact_nativemodule_core.so",
"**/libjscexecutor.so",
]
}
buildFeatures {
prefab true
prefabPublishing true
}
prefab {
rnworklets {
headers "${project.buildDir}/headers/rnworklets/"
}
}
}
dependencies {
implementation "com.facebook.react:react-native"
implementation "com.facebook.react:react-android:+"
if (JS_RUNTIME == "hermes") {
implementation "com.facebook.react:hermes-android"
}
}
preBuild.dependsOn(prepareHeaders)
tasks.configureEach { task ->
// C++ clean
if (task.name.contains("clean")) {
task.dependsOn(deleteCmakeCache)
}
}