Skip to content

Commit

Permalink
add errors
Browse files Browse the repository at this point in the history
  • Loading branch information
karol-bisztyga committed Mar 2, 2021
1 parent b9a6030 commit 6dba77d
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ buck-out/
# Expo
.expo/*
web-build/

android/app/.cxx/
49 changes: 49 additions & 0 deletions android/app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html

# Sets the minimum version of CMake required to build the native library.

cmake_minimum_required(VERSION 3.4.1)

# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.

set(build_DIR ${CMAKE_SOURCE_DIR}/build)
set(PACKAGE_NAME "my_jni_module")

#THIS RESULTS IN AN ERROR:
#Could not find a package configuration file provided by "fbjni" with any of
#the following names:
#
#fbjniConfig.cmake
#fbjni-config.cmake
#
#Add the installation prefix of "fbjni" to CMAKE_PREFIX_PATH or set
#"fbjni_DIR" to a directory containing one of the above files. If "fbjni"
#provides a separate development package or SDK, be sure it has been
#installed.
#find_package(fbjni REQUIRED CONFIG)

add_library( # Sets the name of the library.
${PACKAGE_NAME}

# Sets the library as a shared library.
SHARED

# Provides a relative path to your source file(s).
./src/cpp/sample.cpp
)

target_link_libraries(${PACKAGE_NAME}
# fbjni::fbjni
android
log
)

#target_link_libraries(my_jni_module
# android
# log
# fbjni::fbjni
#)
24 changes: 24 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,24 @@ def jscFlavor = 'org.webkit:android-jsc:+'
*/
def enableHermes = project.ext.react.get("enableHermes", false);

// using mavenCentral() here gives this error:
//Execution failed for task ':app:javaPreCompileDebug'.
//> You must specify a URL for a Maven repository.
repositories {
maven {
url "https://plugins.gradle.org/m2/"
// mavenCentral()
}
}

android {
// this also causes
// Duplicate class com.facebook.jni.xxx found in modules jetified-fbjni-0.1.0-runtime (com.facebook.fbjni:fbjni:0.1.0) and jetified-fbjni-java-only-0.0.3 (com.facebook.fbjni:fbjni-java-only:0.0.3)
// where xxx are 17 different classes
dependencies {
implementation 'com.facebook.fbjni:fbjni:0.1.0'
}

compileSdkVersion rootProject.ext.compileSdkVersion

compileOptions {
Expand Down Expand Up @@ -167,6 +184,12 @@ android {
}
}

externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}

// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
Expand All @@ -183,6 +206,7 @@ android {
}
}


dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
Expand Down
Empty file added android/app/src/cpp/sample.cpp
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.rnfbjni.generated;

import java.util.Arrays;
import java.util.List;
import org.unimodules.core.interfaces.Package;

public class BasePackageList {
public List<Package> getPackageList() {
return Arrays.<Package>asList(
new expo.modules.application.ApplicationPackage(),
new expo.modules.constants.ConstantsPackage(),
new expo.modules.errorrecovery.ErrorRecoveryPackage(),
new expo.modules.filesystem.FileSystemPackage(),
new expo.modules.font.FontLoaderPackage(),
new expo.modules.imageloader.ImageLoaderPackage(),
new expo.modules.keepawake.KeepAwakePackage(),
new expo.modules.lineargradient.LinearGradientPackage(),
new expo.modules.location.LocationPackage(),
new expo.modules.permissions.PermissionsPackage(),
new expo.modules.securestore.SecureStorePackage(),
new expo.modules.splashscreen.SplashScreenPackage(),
new expo.modules.sqlite.SQLitePackage(),
new expo.modules.updates.UpdatesPackage()
);
}
}
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
classpath('com.android.tools.build:gradle:4.1.2')

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
3 changes: 2 additions & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Mon Mar 01 17:15:43 CET 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip

0 comments on commit 6dba77d

Please sign in to comment.