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

Run #1

Open
Lelelo1 opened this issue Feb 8, 2021 · 26 comments
Open

Run #1

Lelelo1 opened this issue Feb 8, 2021 · 26 comments

Comments

@Lelelo1
Copy link
Owner

Lelelo1 commented Feb 8, 2021

npm install react-native

ns platform add android

In my-app/platforms/android/build.gradle add following from a react native project:

// ...
allprojects {
    repositories {
        google()
        jcenter()
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
    }
    beforeEvaluate { project ->
        if (rootProject.hasProperty("userDefinedGradleProperties")) {
            rootProject.ext.userDefinedGradleProperties.each { entry ->
                def propertyName = entry.getKey()
                def propertyValue = entry.getValue()
                project.ext.set(propertyName, propertyValue)
            }
        }
        
    }
}
// ...

To App_Resources/Android/app.gradle add following (as it does also does in a react native project)

/...
dependencies {
  implementation "com.facebook.react:react-native:+";
}

ns build android (check for errors)
ns run android

Log the contents of the com.facebook package on tap event:

//@ts-ignore
for(let key in com.facebook){
    console.log(key);
}

Press TAP ME FOR AN ALERT to log. Note yoga dependency missing in com.facebook

@shirakaba
Copy link

Add maven links to the local react native npm (just like it does in a react native project ):

Which file do you add that to?

@Lelelo1
Copy link
Owner Author

Lelelo1 commented Feb 8, 2021

my-app/platforms/android/build.gradle. The platforms folders did not make through git to repo

@shirakaba
Copy link

shirakaba commented Feb 8, 2021

Tried following these steps in my own project and com.facebook just returns undefined :( I'm not going to be able to help much...

@Lelelo1
Copy link
Owner Author

Lelelo1 commented Feb 9, 2021

It was working for me again in a new rns project

@Lelelo1
Copy link
Owner Author

Lelelo1 commented Feb 9, 2021

Below is full list of content in com.facebook:

JS: BinaryResource
JS: ByteArrayBinaryResource
JS: FileBinaryResource
JS: CacheErrorLogger
JS: CacheEventListener
JS: CacheKey
JS: NoOpCacheErrorLogger
JS: NoOpCacheEventListener
JS: SimpleCacheKey
JS: WriterCallback
JS: WriterCallbacks
JS: DefaultDiskStorage
JS: DiskStorage
JS: DefaultDiskStorageSupplier
JS: DiskCacheConfig
JS: DiskCacheFactory
JS: DiskStorageCache
JS: DiskStorageSupplier
JS: FileCache
JS: Supplier
JS: AndroidPredicates
JS: ByteStreams
JS: Closeables
JS: CountingOutputStream
JS: DoNotStrip
JS: Files
JS: ImmutableList
JS: ImmutableMap
JS: ImmutableSet
JS: Ints
JS: Objects
JS: Preconditions
JS: Sets
JS: Suppliers
JS: Throwables
JS: VisibleForTesting
JS: DiskTrimmableRegistry
JS: DiskTrimmable
JS: NoOpDiskTrimmableRegistry
JS: ActivityListener
JS: ActivityListenerManager
JS: BaseActivityListener
JS: ListenableActivity
JS: CallerThreadExecutor
JS: ConstrainedExecutorService
JS: DefaultSerialExecutorService
JS: HandlerExecutorService
JS: HandlerExecutorServiceImpl
JS: ScheduledFutureImpl
JS: SerialExecutorService
JS: StatefulRunnable
JS: UiThreadImmediateExecutorService
JS: FileTree
JS: FileTreeVisitor
JS: FileUtils
JS: FLog
JS: LoggingDelegate
JS: FLogDefaultLoggingDelegate
JS: MediaUtils
JS: MemoryTrimType
JS: MemoryTrimmable
JS: MemoryTrimmableRegistry
JS: NoOpMemoryTrimmableRegistry
JS: CloseableReference
JS: SharedReference
JS: ResourceReleaser
JS: OOMSoftReference
JS: SoLoaderShim
JS: StatFsHelper
JS: LimitedInputStream
JS: TailAppendingInputStream
JS: Clock
JS: CurrentThreadTimeClock
JS: MonotonicClock
JS: RealtimeSinceBootClock
JS: SystemClock
JS: ByteConstants
JS: HashCodeUtil
JS: Hex
JS: SecureHashUtil
JS: StreamUtil
JS: TriState
JS: UriUtil
JS: TopLoadingErrorEvent
JS: TopLoadingFinishEvent
JS: TopLoadingStartEvent
JS: Event
JS: RCTEventEmitter
JS: EventDispatcher
JS: NativeGestureUtil
JS: TouchEvent
JS: TouchEventType
JS: TouchEventCoalescingKeyHelper
JS: SizeMonitoringFrameLayout
JS: UIImplementationProvider
JS: AppRegistry
JS: BaseViewManager
JS: ViewManager
JS: ThemedReactContext
JS: ReactShadowNode
JS: ReactStylesDiffMap
JS: BaseViewPropertyApplicator
JS: CatalystStylesDiffMap
JS: DisplayMetricsHolder
JS: GuardedChoreographerFrameCallback
JS: IllegalViewOperationException
JS: LayoutShadowNode
JS: UIViewOperationQueue
JS: MeasureSpecAssertions
JS: NativeViewHierarchyManager
JS: ViewManagerRegistry
JS: ViewAtIndex
JS: NativeViewHierarchyOptimizer
JS: ShadowNodeRegistry
JS: NoSuchNativeViewException
JS: OnLayoutEvent
JS: PixelUtil
JS: PointerEvents
JS: ReactChoreographer
JS: ReactCompoundView
JS: ReactInvalidPropertyException
JS: ReactNative
JS: ReactPointerEventsView
JS: ReactProp
JS: ReactPropGroup
JS: RootView
JS: RootViewManager
JS: ViewGroupManager
JS: RootViewUtil
JS: SimpleViewManager
JS: TouchTargetHelper
JS: UIImplementation
JS: NotThreadSafeViewHierarchyUpdateDebugListener
JS: DebugComponentOwnershipModule
JS: NotThreadSafeUiManagerDebugListener
JS: UIManagerModule
JS: UIProp
JS: ViewDefaults
JS: ViewManagerPropertyUpdater
JS: ViewProps
JS: ReactProp
JS: ReactPropGroup
JS: ReactPropertyHolder
JS: LayoutAnimationController
JS: WritableMap
JS: ReactApplicationContext
JS: ReactContext
JS: ActivityEventListener
JS: LifecycleEventListener
JS: CatalystInstance
JS: JavaScriptModule
JS: NativeModule
JS: NativeModuleCallExceptionHandler
JS: NotThreadSafeBridgeIdleDebugListener
JS: Arguments
JS: WritableArray
JS: WritableNativeArray
JS: ReadableNativeArray
JS: NativeArray
JS: ReadableNativeMap
JS: NativeMap
JS: ReadableType
JS: ReadableMap
JS: AssertionException
JS: BaseJavaModule
JS: BridgeProfiling
JS: Callback
JS: CallbackImpl
JS: ReactQueueConfiguration
JS: ReactQueueConfigurationSpec
JS: MessageQueueThread
JS: CatalystQueueConfiguration
JS: CatalystQueueConfigurationImpl
JS: CatalystQueueConfigurationSpec
JS: QueueThreadExceptionHandler
JS: MessageQueueThreadSpec
JS: MessageQueueThreadHandler
JS: MessageQueueThreadImpl
JS: MessageQueueThreadRegistry
JS: NativeRunnable
JS: NativeRunnableDeprecated
JS: ProxyQueueThreadExceptionHandler
JS: ReactQueueConfigurationImpl
JS: MemoryPressure
JS: CatalystInstanceImpl
JS: JSBundleLoader
JS: JavaScriptExecutor
JS: JavaScriptModulesConfig
JS: NativeModuleRegistry
JS: DefaultNativeModuleCallExceptionHandler
JS: GuardedAsyncTask
JS: GuardedResultAsyncTask
JS: InvalidIteratorException
JS: JSApplicationCausedNativeException
JS: JSApplicationIllegalArgumentException
JS: ReactBridge
JS: JSCJavaScriptExecutor
JS: JSDebuggerWebSocketClient
JS: JSExecutionException
JS: JavaJSExecutor
JS: JsonGeneratorHelper
JS: NativeArgumentsParseException
JS: NoSuchKeyException
JS: ObjectAlreadyConsumedException
JS: OnBatchCompleteListener
JS: Promise
JS: PromiseImpl
JS: ProxyJavaScriptExecutor
JS: ReactCallback
JS: ReactContextBaseJavaModule
JS: ReactMarker
JS: ReactMethod
JS: ReadableArray
JS: ReadableMapKeySetIterator
JS: SoftAssertions
JS: Systrace
JS: UiThreadUtil
JS: UnexpectedNativeTypeException
JS: WebsocketJavaScriptExecutor
JS: WritableNativeMap
JS: WebWorkers
JS: BuildConfig
JS: CompositeReactPackage
JS: ReactPackage
JS: LifecycleState
JS: MemoryPressureRouter
JS: ReactActivity
JS: ReactInstanceManager
JS: ReactRootView
JS: DevSupportManager
JS: DebugServerException
JS: DevInternalSettings
JS: DevOptionHandler
JS: DevServerHelper
JS: DevSettingsActivity
JS: DevSupportManagerImpl
JS: ReactInstanceDevCommandsHandler
JS: DisabledDevSupportManager
JS: FpsView
JS: DefaultHardwareBackBtnHandler
JS: DeviceEventManagerModule
JS: ExceptionsManagerModule
JS: JSTimersExecution
JS: JavascriptException
JS: RCTNativeAppEventEmitter
JS: Timing
JS: DeveloperSettings
JS: AnimationsDebugModule
JS: DidJSUpdateUiDuringFrameDetector
JS: FpsDebugFrameCallback
JS: SourceCodeModule
JS: AppStateModule
JS: CameraRollManager
JS: ImageEditingManager
JS: ImageStoreManager
JS: ClipboardModule
JS: ModuleDataCleaner
JS: DatePickerDialogFragment
JS: DatePickerDialogModule
JS: DismissableDatePickerDialog
JS: SupportDatePickerDialogFragment
JS: DialogModule
JS: FrescoModule
JS: SystraceRequestListener
JS: IntentModule
JS: LocationModule
JS: NetInfoModule
JS: ForwardingCookieHandler
JS: NetworkingModule
JS: OkHttpClientProvider
JS: StatusBarModule
JS: AsyncStorageErrorUtil
JS: AsyncStorageModule
JS: ReactDatabaseSupplier
JS: AndroidInfoModule
JS: DismissableTimePickerDialog
JS: SupportTimePickerDialogFragment
JS: TimePickerDialogFragment
JS: TimePickerDialogModule
JS: ToastModule
JS: WebSocketModule
JS: AbstractFloatPairPropertyUpdater
JS: AbstractSingleFloatProperyUpdater
JS: Animation
JS: AnimationPropertyUpdater
JS: AnimationListener
JS: AnimationRegistry
JS: ImmediateAnimation
JS: NoopAnimationPropertyUpdater
JS: OpacityAnimationPropertyUpdater
JS: PositionAnimationPairPropertyUpdater
JS: RotationAnimationPropertyUpdater
JS: ScaleXAnimationPropertyUpdater
JS: ScaleXYAnimationPairPropertyUpdater
JS: ScaleYAnimationPropertyUpdater
JS: ApplicationHolder
JS: LongArray
JS: MapBuilder
JS: ReactConstants
JS: SetBuilder
JS: ShakeDetector
JS: SystemClock
JS: VisibleForTesting
JS: ReactBuildConfig
JS: SimpleSettableFuture
JS: MainReactPackage
JS: CatalystInterceptingViewGroup
JS: OnInterceptTouchEventListener
JS: JSResponderHandler
JS: ReactInterceptingViewGroup
JS: ARTGroupShadowNode
JS: ARTVirtualNode
JS: ARTRenderableViewManager
JS: ARTShapeShadowNode
JS: ARTSurfaceView
JS: ARTSurfaceViewManager
JS: ARTSurfaceViewShadowNode
JS: ARTTextShadowNode
JS: ReactDrawerLayoutManager
JS: ReactDrawerLayout
JS: DrawerClosedEvent
JS: DrawerOpenedEvent
JS: DrawerSlideEvent
JS: DrawerStateChangedEvent
JS: ImageLoadEvent
JS: ImageResizeMode
JS: ReactImageManager
JS: ReactImageView
JS: ReactDialogPickerManager
JS: ReactPickerManager
JS: ReactPicker
JS: ReactDropdownPickerManager
JS: PickerItemSelectEvent
JS: ProgressBarShadowNode
JS: ReactProgressBarViewManager
JS: ProgressBarContainerView
JS: ContentSizeChangeEvent
JS: RecyclerViewBackedScrollView
JS: RecyclerViewBackedScrollViewManager
JS: ReactScrollViewCommandHelper
JS: OnScrollDispatchHelper
JS: ReactHorizontalScrollView
JS: ReactHorizontalScrollViewManager
JS: ReactScrollView
JS: ReactScrollViewHelper
JS: ReactScrollViewManager
JS: ScrollEvent
JS: ScrollEventType
JS: ReactSwipeRefreshLayout
JS: RefreshEvent
JS: SwipeRefreshLayoutManager
JS: ReactSwitchManager
JS: ReactSwitch
JS: CustomStyleSpan
JS: DefaultStyleValuesUtil
JS: ReactFontManager
JS: ReactRawTextManager
JS: ReactTextViewManager
JS: ReactTextShadowNode
JS: ReactTextView
JS: ReactTagSpan
JS: ReactTextInlineImageShadowNode
JS: ReactTextInlineImageViewManager
JS: ReactTextUpdate
JS: ReactVirtualTextViewManager
JS: ShadowStyleSpan
JS: TextInlineImageSpan
JS: ReactEditText
JS: SelectionWatcher
JS: ReactTextChangedEvent
JS: ReactTextInputEvent
JS: ReactTextInputManager
JS: ReactTextInputShadowNode
JS: ReactTextUpdate
JS: DrawableWithIntrinsicSize
JS: ReactToolbar
JS: ReactToolbarManager
JS: ToolbarClickEvent
JS: ColorUtil
JS: ReactClippingViewGroup
JS: ReactClippingViewGroupHelper
JS: ReactDrawableHelper
JS: ReactViewGroup
JS: ReactViewManager
JS: ReactViewPagerManager
JS: ReactViewPager
JS: ReactWebViewManager
JS: WebViewConfig
JS: CSSAlign
JS: CSSConstants
JS: CSSDirection
JS: CSSFlexDirection
JS: CSSJustify
JS: CSSLayout
JS: CSSLayoutContext
JS: CSSNode
JS: Spacing
JS: CSSPositionType
JS: CSSWrap
JS: MeasureOutput
JS: CSSStyle
JS: CachedCSSLayout
JS: FloatUtil
JS: LayoutEngine
JS: AbstractDataSource
JS: DataSubscriber
JS: BaseBooleanSubscriber
JS: DataSource
JS: BaseDataSubscriber
JS: DataSources
JS: FirstAvailableDataSourceSupplier
JS: IncreasingQualityDataSourceSupplier
JS: SettableDataSource
JS: DrawableWithCaches
JS: BuildConfig
JS: BuildConfig
JS: Fresco
JS: PipelineDraweeControllerBuilderSupplier
JS: PipelineDraweeControllerBuilder
JS: PipelineDraweeController
JS: PipelineDraweeControllerFactory
JS: AbstractDraweeControllerBuilder
JS: AbstractDraweeController
JS: ControllerListener
JS: BaseControllerListener
JS: ForwardingControllerListener
JS: DraweeController
JS: DraweeHierarchy
JS: SettableDraweeHierarchy
JS: SimpleDraweeControllerBuilder
JS: DeferredReleaser
JS: RetryManager
JS: DraweeEventTracker
JS: GestureDetector
JS: ArrayDrawable
JS: TransformCallback
JS: AutoRotateDrawable
JS: ForwardingDrawable
JS: DrawableProperties
JS: DrawableUtils
JS: FadeDrawable
JS: MatrixDrawable
JS: OrientedDrawable
JS: ProgressBarDrawable
JS: Rounded
JS: RoundedBitmapDrawable
JS: RoundedColorDrawable
JS: RoundedCornersDrawable
JS: ScaleTypeDrawable
JS: ScalingUtils
JS: SettableDrawable
JS: TransformAwareDrawable
JS: VisibilityAwareDrawable
JS: VisibilityCallback
JS: GenericDraweeHierarchy
JS: RoundingParams
JS: GenericDraweeHierarchyBuilder
JS: AspectRatioMeasure
JS: DraweeHolder
JS: DraweeView
JS: GenericDraweeView
JS: MultiDraweeHolder
JS: SimpleDraweeView
JS: ImagePipeline
JS: ImagePipelineFactory
JS: ImagePipelineConfig
JS: DefaultExecutorSupplier
JS: ExecutorSupplier
JS: ProducerSequenceFactory
JS: PriorityThreadFactory
JS: ProducerFactory
JS: AnimatedDrawableFactory
JS: AnimatedImageFactory
JS: AnimatableDrawable
JS: AnimatedDrawable
JS: AnimatedDrawableCachingBackend
JS: AnimatedDrawableDiagnostics
JS: AnimatedDrawableBackend
JS: AnimatedImageResult
JS: AnimatedDrawableFrameInfo
JS: AnimatedDrawableOptions
JS: AnimatedDrawableOptionsBuilder
JS: AnimatedImage
JS: AnimatedImageFrame
JS: AnimatedImageResultBuilder
JS: DelegatingAnimatedDrawableBackend
JS: AnimatedDrawableBackendProvider
JS: AnimatedDrawableCachingBackendImplProvider
JS: AnimatedDrawableBackendImpl
JS: AnimatedDrawableCachingBackendImpl
JS: AnimatedDrawableDiagnosticsImpl
JS: AnimatedDrawableDiagnosticsNoop
JS: AnimatedFrameCache
JS: AnimatedImageCompositor
JS: AnimatedDrawableUtil
JS: ImageInfo
JS: CloseableImage
JS: EncodedImage
JS: QualityInfo
JS: CloseableStaticBitmap
JS: CloseableBitmap
JS: CloseableAnimatedBitmap
JS: CloseableAnimatedImage
JS: ImmutableQualityInfo
JS: ImageRequest
JS: BasePostprocessor
JS: BaseRepeatedPostProcessor
JS: RepeatedPostprocessorRunner
JS: ImageRequestBuilder
JS: Postprocessor
JS: RepeatedPostprocessor
JS: BuildConfig
JS: PlatformBitmapFactory
JS: ArtBitmapFactory
JS: EmptyJpegGenerator
JS: GingerbreadBitmapFactory
JS: HoneycombBitmapFactory
JS: SimpleBitmapReleaser
JS: ImageDecodeOptions
JS: ResizeOptions
JS: ImageDecodeOptionsBuilder
JS: Priority
JS: TooManyBitmapsException
JS: CountingMemoryCache
JS: BitmapCountingMemoryCacheFactory
JS: BitmapMemoryCacheFactory
JS: MemoryCache
JS: ImageCacheStatsTracker
JS: BitmapMemoryCacheKey
JS: BitmapMemoryCacheTrimStrategy
JS: BufferedDiskCache
JS: CacheKeyFactory
JS: CountingLruMap
JS: ValueDescriptor
JS: MemoryCacheParams
JS: CountingMemoryCacheInspector
JS: DefaultBitmapMemoryCacheParamsSupplier
JS: DefaultCacheKeyFactory
JS: DefaultEncodedMemoryCacheParamsSupplier
JS: EncodedCountingMemoryCacheFactory
JS: EncodedMemoryCacheFactory
JS: InstrumentedMemoryCache
JS: MemoryCacheTracker
JS: NativeMemoryCacheTrimStrategy
JS: NoOpImageCacheStatsTracker
JS: StagingArea
JS: BuildConfig
JS: OkHttpImagePipelineConfigFactory
JS: OkHttpNetworkFetcher
JS: BaseNetworkFetcher
JS: FetchState
JS: Consumer
JS: ProducerContext
JS: ProducerListener
JS: NetworkFetcher
JS: AddImageTransformMetaDataProducer
JS: Producer
JS: ThreadHandoffProducer
JS: BitmapMemoryCacheGetProducer
JS: BitmapMemoryCacheProducer
JS: BitmapMemoryCacheKeyMultiplexProducer
JS: MultiplexProducer
JS: BranchOnSeparateImagesProducer
JS: LocalContentUriFetchProducer
JS: LocalFetchProducer
JS: DataFetchProducer
JS: DecodeProducer
JS: DiskCacheProducer
JS: EncodedCacheKeyMultiplexProducer
JS: EncodedMemoryCacheProducer
JS: LocalAssetFetchProducer
JS: LocalExifThumbnailProducer
JS: LocalFileFetchProducer
JS: LocalResourceFetchProducer
JS: LocalVideoThumbnailProducer
JS: NetworkFetchProducer
JS: NullProducer
JS: PostprocessedBitmapMemoryCacheProducer
JS: PostprocessorProducer
JS: ResizeAndRotateProducer
JS: SwallowResultProducer
JS: ThrottlingProducer
JS: WebpTranscodeProducer
JS: SettableProducerContext
JS: BaseProducerContext
JS: ProducerContextCallbacks
JS: BaseConsumer
JS: BaseProducerContextCallbacks
JS: DelegatingConsumer
JS: DownsampleUtil
JS: HttpUrlConnectionNetworkFetcher
JS: JobScheduler
JS: RemoveImageTransformMetaDataProducer
JS: StatefulProducerRunnable
JS: BitmapPool
JS: BasePool
JS: PoolParams
JS: PoolStatsTracker
JS: PooledByteBufferFactory
JS: PooledByteStreams
JS: PoolFactory
JS: ByteArrayPool
JS: BitmapCounter
JS: BitmapCounterProvider
JS: DefaultBitmapPoolParams
JS: DefaultByteArrayPoolParams
JS: DefaultFlexByteArrayPoolParams
JS: DefaultNativeMemoryChunkPoolParams
JS: FlexByteArrayPool
JS: GenericByteArrayPool
JS: NativeMemoryChunk
JS: NativeMemoryChunkPool
JS: NativePooledByteBuffer
JS: NativePooledByteBufferFactory
JS: NativePooledByteBufferOutputStream
JS: PooledByteBufferOutputStream
JS: PooledByteBuffer
JS: NoOpPoolStatsTracker
JS: Pool
JS: PoolConfig
JS: SharedByteArray
JS: PooledByteArrayBufferedInputStream
JS: PooledByteBufferInputStream
JS: PlatformDecoder
JS: ArtDecoder
JS: GingerbreadPurgeableDecoder
JS: DalvikPurgeableDecoder
JS: KitKatPurgeableDecoder
JS: ImageDecoder
JS: ProgressiveJpegConfig
JS: DecodeException
JS: ProgressiveJpegParser
JS: SimpleProgressiveJpegConfig
JS: AbstractProducerToDataSourceAdapter
JS: BaseBitmapDataSubscriber
JS: BaseListBitmapDataSubscriber
JS: CloseableProducerToDataSourceAdapter
JS: ListDataSource
JS: ProducerToDataSourceAdapter
JS: SettableDataSource
JS: RequestListener
JS: BaseRequestListener
JS: ForwardingRequestListener
JS: RequestLoggingListener
JS: GifFrame
JS: GifImage
JS: Bitmaps
JS: ImagePipelineNativeLoader
JS: JpegTranscoder
JS: WebpTranscoder
JS: WebPFrame
JS: WebPImage
JS: WebpSupportStatus
JS: BuildConfig
JS: GifFormatChecker
JS: ImageFileExtensionMap
JS: ImageFormat
JS: ImageFormatChecker
JS: BitmapUtil
JS: JfifUtil
JS: Assertions
JS: Initializer
JS: Mutable
JS: Present
JS: Strict
JS: SuppressFieldNotInitialized
JS: SuppressFieldNotNullable
JS: SuppressNullFieldAccess
JS: SuppressNullMethodCall
JS: SuppressParameterNotNullable
JS: SuppressReturnOverAnnotated
JS: Countable
JS: CppException
JS: CppSystemErrorException
JS: HybridData
JS: Prerequisites
JS: UnknownCppException
JS: PerfTestConfig
JS: DoNotStrip
JS: KeepGettersAndSetters
JS: QuickPerformanceLogger
JS: QuickPerformanceLoggerProvider
JS: ActionId
JS: ReactNativeBridge
JS: ApkSoSource
JS: DirectorySoSource
JS: SoSource
JS: Elf32_Dyn
JS: Elf32_Ehdr
JS: Elf32_Phdr
JS: Elf32_Shdr
JS: Elf64_Dyn
JS: Elf64_Ehdr
JS: Elf64_Phdr
JS: Elf64_Shdr
JS: ExoSoSource
JS: FileLocker
JS: MinElf
JS: NativeLibrary
JS: NoopSoSource
JS: SoLoader
JS: BuildConfig
JS: DumperPluginsProvider
JS: InspectorModulesProvider
JS: R
JS: Stetho
JS: DumperPlugin
JS: ArgsHelper
JS: DumpException
JS: DumpUsageException

Used:

// This function handles arrays and objects // https://stackoverflow.com/questions/2549320/looping-through-an-object-tree-recursively
function eachRecursive(obj) // com.facebook
{
    for (var k in obj)
    {
        if (typeof obj[k] == "object" && obj[k] !== null)
            eachRecursive(obj[k]);
        else
            console.log(k);
    }
}

@shirakaba
Copy link

Cool! So still no yoga, but nice to see LayoutEngine (which might in fact call yoga internally) and especially UIManagerModule, ViewManager and ReactViewManager!

I'll keep bashing at it over the next few days to try to get it to build as a modular NativeScript plugin with typings and stuff, rather than something that you add directly to your app.

In the meantime, you might want to play around with creating views and seeing whether you can insert them into the view tree! Would be worth researching what UIManagerModule and ViewManager do – ReactViewManager might help explain that.

@Lelelo1
Copy link
Owner Author

Lelelo1 commented Feb 9, 2021

Sure I can try that out!

@shirakaba
Copy link

I'm still unable to build it as a plugin – just keep finding com.facebook is undefined.

However, I was at least able to use android-dts-generator to generate TypeScript typings for React Native Android:

https://raw.githubusercontent.com/nativescript-community/react-native-in-nativescript/master/src/typings/java!react-native-0.63.4.d.ts

You'll notice that if you search for module yoga, com.facebook.yoga does actually exist in the typings – so I don't understand why it's not available at runtime.

@shirakaba
Copy link

shirakaba commented Feb 10, 2021

@Lelelo1 Could you share the whole contents of your my-app/platforms/android/build.gradle and the whole contents of your App_Resources/Android/app.gradle? Trying to understand why your setup isn't working on my side.

@shirakaba
Copy link

A thought occurred to me just now, as to my understanding I’m failing to get the JAR from node_modules/react-native compiled into the app’s runtime... maybe I could try copying that JAR as-is into the plugin (the app’s build script looks for JAR files inside the plugin, so it would pick that up).

The downside is that the plugin would never be able to stay in sync automatically with all future versions of RN (we’d have to regenerate it with each version update), but for a proof of concept plugin, it might be worth a try to get things moving. I’ll give it a go tomorrow if I can.

@Lelelo1
Copy link
Owner Author

Lelelo1 commented Feb 10, 2021

my-app/platforms/android/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    def initialize = { ->
        def userDir = "${rootProject.projectDir}/../.."
        apply from: "$rootDir/gradle-helpers/user_properties_reader.gradle"
        apply from: "$rootDir/gradle-helpers/paths.gradle"
        rootProject.ext.userDefinedGradleProperties = getUserProperties("${getAppResourcesPath(userDir)}/Android")
        if (rootProject.hasProperty("userDefinedGradleProperties")) {
            rootProject.ext.userDefinedGradleProperties.each { entry ->
                def propertyName = entry.getKey()
                def propertyValue = entry.getValue()
                project.ext.set(propertyName, propertyValue)
            }
        }
    }
    initialize()

    def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "1.3.72"
    }
    def kotlinVersion = computeKotlinVersion()

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
    }
    beforeEvaluate { project ->
        if (rootProject.hasProperty("userDefinedGradleProperties")) {
            rootProject.ext.userDefinedGradleProperties.each { entry ->
                def propertyName = entry.getKey()
                def propertyValue = entry.getValue()
                project.ext.set(propertyName, propertyValue)
            }
        }

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

App_Resources/Android/app.gradle

// Add your native dependencies here:

// Uncomment to add recyclerview-v7 dependency
//dependencies {
//	implementation 'com.android.support:recyclerview-v7:+'
//}

// If you want to add something to be applied before applying plugins' include.gradle files
// e.g. project.ext.googlePlayServicesVersion = "15.0.1"
// create a file named before-plugins.gradle in the current directory and place it there

android {
  defaultConfig {
    minSdkVersion 17
    generatedDensities = []
  }
  aaptOptions {
    additionalParameters "--no-version-vectors"
  }
}

dependencies {
  implementation "com.facebook.react:react-native:+";
}

I think that react-native-0.63.4.aar is the one used, you have that one in react-native/android right?

@shirakaba
Copy link

I think that react-native-0.63.4.aar is the one used, you have that one in react-native/android right?

Yeah, that's the one I was thinking about in this comment:

A thought occurred to me just now, as to my understanding I’m failing to get the JAR from node_modules/react-native compiled into the app’s runtime... maybe I could try copying that JAR as-is into the plugin (the app’s build script looks for JAR files inside the plugin, so it would pick that up).

To generate the typings, I actually entered your gradle settings into android-dts-generator and let it handle the rest. Hope it's exactly the same as react-native-0.63.4.aar in practice. Either way, it generated over 800 KB of Java classes and 2 MB of TypeScript typings, so there's clearly a lot of stuff inside the thing it built.

@Lelelo1
Copy link
Owner Author

Lelelo1 commented Feb 10, 2021

I'ts a bit to hard to comprehend what happens and what should happen, but we might figure something good out

@shirakaba
Copy link

I've been trying to build it as a plugin here: https://github.com/nativescript-community/react-native-in-nativescript

Could you try running my project? Wondering whether your environment works better than mine.

git clone https://github.com/nativescript-community/react-native-in-nativescript.git  --recursive
cd react-native-in-nativescript
npm install
npm run setup
npm run build
cd demo-react
tns build android
# Or go into Android Studio and run the app to get full error logs
tns run android --no-hmr

On my side I'm getting JNI errors from React Native at startup; I can't get as far as logging out com.facebook anymore:

E/ipt.reactnativ: JNI ERROR (app bug): attempt to pass an instance of java.lang.String as argument 1 to org.json.JSONObject com.facebook.react.uimanager.ViewHierarchyDumper.toJSON(android.view.View)
A/ipt.reactnativ: java_vm_ext.cc:570] JNI DETECTED ERROR IN APPLICATION: bad arguments passed to org.json.JSONObject com.facebook.react.uimanager.ViewHierarchyDumper.toJSON(android.view.View) (see above for details)
    java_vm_ext.cc:570]     from void com.tns.Runtime.runModule(int, java.lang.String)
A/ipt.reactnativ: runtime.cc:630] Runtime aborting...
    runtime.cc:630] Dumping all threads without mutator lock held
...

@shirakaba
Copy link

Forget about cloning my project. I've just cloned your project and found yours to be working as you've described, so I compared to mine.

I wasn't able to run yours successfully with the files you've committed so far (I think you've committed some build files). I had to run tns clean.

I decided to try each of your changes individually (the changes to my-app/platforms/android/build.gradle, App_Resources/Android/app.gradle, and the npm install of react-native).

I found that:

  • I did not need to install the react-native npm package.
  • I did not need to change my-app/platforms/android/build.gradle.
  • I did need to change App_Resources/Android/app.gradle.

The result:

JS: binaryresource
JS: cache
JS: common
JS: catalyst
JS: react
JS: csslayout
JS: datasource
JS: drawable
JS: drawee
JS: imagepipeline
JS: fbcore
JS: imageformat
JS: imageutils
JS: infer
JS: jni
JS: perftest
JS: proguard
JS: quicklog
JS: soloader
JS: stetho
JS: systrace

So this is the worrying thing. I think NativeScript is totally ignoring your changes to the .gradle files that tell it to build React Native from node_modules. Instead, I believe it's downloading this old build of react native from 2015: https://mvnrepository.com/artifact/com.facebook/react.

I've not had any luck building from the AAR in node_modules/react-native. I'll try to find a way to confirm what exact version of the React Native lib is being included into your app and my app.

@shirakaba
Copy link

shirakaba commented Feb 11, 2021

I’ve had a thought. As I’m unsure whether your setup is installing the AAR from node_modules or from maven, maybe the simplest way to check would be to print out the React Native version number by console log.

If you search through my typings file for the term “version”, there are only a small number of mentions. See if you can call an API to print out the version number for the build of React Native that your app is running :)

https://raw.githubusercontent.com/nativescript-community/react-native-in-nativescript/master/src/typings/java!react-native-0.63.4.d.ts

@shirakaba
Copy link

Maybe:

console.log(com.facebook.react.BuildConfig.VERSION_NAME);
console.log(com.facebook.react.BuildConfig.VERSION_CODE);

@shirakaba
Copy link

There’s also this, if I’ve copied it correctly:

console.log(com.facebook.react.modules.systeminfo.ReactNativeVersion.VERSION);

@Lelelo1
Copy link
Owner Author

Lelelo1 commented Feb 11, 2021

About those version info namespaces they don't appear to correspond to the current react-native repo completely. There could som reasons to it and I don't know yet how frequently it is.

However in the App_Resources, try:

dependencies {
  implementation "com.facebook.react:react-native:version"; // + -> version
}

You will see gradle log redlines trying to find react-native.jar on the local file system. And try to get .pom from remote.

I don't know what the + means though, it is what is present in react native project

@shirakaba
Copy link

shirakaba commented Feb 11, 2021

About those version info namespaces they don't appear to correspond to the current react-native repo completely. There could som reasons to it and I don't know yet how frequently it is.

I think that suggests that the version of React Native that this repo installs is much older than v0.63.4, which the typings were generated for.

Note that when you ran this code, it logged multiple mentions of BuildConfig, which I'd expect to include a VERSION_NAME and VERSION_CODE:

// This function handles arrays and objects // https://stackoverflow.com/questions/2549320/looping-through-an-object-tree-recursively
function eachRecursive(obj) // com.facebook
{
    for (var k in obj)
    {
        if (typeof obj[k] == "object" && obj[k] !== null)
            eachRecursive(obj[k]);
        else
            console.log(k);
    }
}

So could you try running this to get the full key paths for everything in com.facebook and see whether VERSION_NAME or VERSION_CODE appear?

const visitedValues = new Set();

function eachRecursive(path, value){
    if(visitedValues.has(value)){
        // Crude protection against following circular references in an infinite loop
        console.log(`${path} [Already visited, so won't recurse]`);
        return;
    }
    visitedValues.add(value);
    for(let key in value){
        const newPath = /^\d+$/.test(key) ? `${path}[${key}]` : `${path}.${key}`;

        if (typeof value[key] === "object" && value[key] !== null){
            eachRecursive(newPath, value[key]);
        } else {
            console.log(newPath);
        }
    }
}

eachRecursive("com.facebook", com.facebook);

You will see gradle log redlines trying to find react-native.jar on the local file system. And try to get .pom from remote.

When you mentioned this on Slack, you reported that it searched in these locations:

Could not find com.facebook.react:react-native:.
Searched in the following locations:
  - file:/Users/hemma/Projects/my-app/node_modules/@nativescript/core/platforms/android/react-native.jar
  - file:/Users/hemma/Projects/my-app/node_modules/@nativescript/core/platforms/android/libs/react-native.jar
  - file:/Users/hemma/Projects/my-app/platforms/android/app/libs/runtime-libs/react-native.jar
  - file:/Users/hemma/Projects/my-app/App_Resources/Android/libs/react-native.jar
Required by:
    project :app

I should note that it didn't look in node_modules/react-native at all, so indeed, I think this is downloading from the outdated online repo.

@Lelelo1
Copy link
Owner Author

Lelelo1 commented Feb 11, 2021

You are probably correct that it downloads from outdated online repo.

If you look into are react native project though. The lines have to do something:

// ...
       maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

@Lelelo1
Copy link
Owner Author

Lelelo1 commented Feb 11, 2021

Actually those urls are not added unless being placed inside the App_resources/Android/app.gradle:

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android/one")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist/two")
        }
    }
}
android {
  defaultConfig {
    minSdkVersion 17
    generatedDensities = []
  }
  aaptOptions {
    additionalParameters "--no-version-vectors"
  }
}

dependencies {
  implementation "com.facebook.react:react-native:version";
}

It will then look in two extra places: (in */one and */two folders)

@Lelelo1
Copy link
Owner Author

Lelelo1 commented Feb 11, 2021

Now it uses local react native version 0.63.4. I noticed using 0.63.4 it would not work before but it builds now without errors

So it is now possible to log:

console.log(com.facebook.react.modules.systeminfo.ReactNativeVersion);

{patch=4, major=0, minor=63, prerelease=null}

@shirakaba
Copy link

shirakaba commented Feb 11, 2021

Okay, trying on my project now.

Attempt 1 🚫

  • without having react-native installed in node_modules (nor specified in package.json)
  • with dependencies { implementation "com.facebook.react:react-native:0.63.4"; } in demo-react/App_Resources/Android/app.gradle
  • without any repositories specified in demo-react/App_Resources/Android/app.gradle.
Gradle build...
         + setting applicationId
         + applying user-defined configuration from /Users/jamie/Documents/git/react-native-in-nativescript/demo-react/App_Resources/Android/app.gradle
         + using android X library androidx.legacy:legacy-support-v4:1.0.0
         + adding nativescript runtime package dependency: nativescript-optimized-with-inspector
         + adding aar plugin dependency: /Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/core/platforms/android/widgets-release.aar
         + adding aar plugin dependency: /Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/detox/platforms/android/detox.aar

Build file '/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/platforms/android/app/build.gradle' line: 633
A problem occurred configuring project ':app'.
Could not find com.facebook.react:react-native:0.63.4.
Searched in the following locations:
  - https://dl.google.com/dl/android/maven2/com/facebook/react/react-native/0.63.4/react-native-0.63.4.pom
  - https://jcenter.bintray.com/com/facebook/react/react-native/0.63.4/react-native-0.63.4.pom
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/detox/Detox-android/com/facebook/react/react-native/0.63.4/react-native-0.63.4.pom
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/core/platforms/android/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/core/platforms/android/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/detox/platforms/android/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/detox/platforms/android/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/theme/platforms/android/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/theme/platforms/android/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/core/platforms/android/libs/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/core/platforms/android/libs/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/detox/platforms/android/libs/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/detox/platforms/android/libs/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/theme/platforms/android/libs/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/theme/platforms/android/libs/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/platforms/android/app/libs/runtime-libs/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/platforms/android/app/libs/runtime-libs/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/App_Resources/Android/libs/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/App_Resources/Android/libs/react-native.jar
  - https://repo.maven.apache.org/maven2/com/facebook/react/react-native/0.63.4/react-native-0.63.4.pom
Required by:
    project :app

Command ./gradlew failed with exit code 1

Attempt 2 🚫

  • without having react-native installed in node_modules (nor specified in package.json)
  • with dependencies { implementation "com.facebook.react:react-native:0.63.4"; } in demo-react/App_Resources/Android/app.gradle
  • with the repositories specified in demo-react/App_Resources/Android/app.gradle. We're using maven { url("$rootDir/../../node_modules/react-native/android") } but not specifying the extra maven field about jsc-android.
Gradle build...
         + setting applicationId
         + applying user-defined configuration from /Users/jamie/Documents/git/react-native-in-nativescript/demo-react/App_Resources/Android/app.gradle
         + using android X library androidx.legacy:legacy-support-v4:1.0.0
         + adding nativescript runtime package dependency: nativescript-optimized-with-inspector
         + adding aar plugin dependency: /Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/core/platforms/android/widgets-release.aar
         + adding aar plugin dependency: /Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/detox/platforms/android/detox.aar

Build file '/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/platforms/android/app/build.gradle' line: 633
A problem occurred configuring project ':app'.
Could not find com.facebook.react:react-native:0.63.4.
Searched in the following locations:
  - https://dl.google.com/dl/android/maven2/com/facebook/react/react-native/0.63.4/react-native-0.63.4.pom
  - https://jcenter.bintray.com/com/facebook/react/react-native/0.63.4/react-native-0.63.4.pom
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/detox/Detox-android/com/facebook/react/react-native/0.63.4/react-native-0.63.4.pom
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/react-native/android/com/facebook/react/react-native/0.63.4/react-native-0.63.4.pom
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/core/platforms/android/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/core/platforms/android/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/detox/platforms/android/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/detox/platforms/android/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/theme/platforms/android/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/theme/platforms/android/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/core/platforms/android/libs/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/core/platforms/android/libs/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/detox/platforms/android/libs/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/detox/platforms/android/libs/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/theme/platforms/android/libs/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/theme/platforms/android/libs/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/platforms/android/app/libs/runtime-libs/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/platforms/android/app/libs/runtime-libs/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/App_Resources/Android/libs/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/App_Resources/Android/libs/react-native.jar
  - https://repo.maven.apache.org/maven2/com/facebook/react/react-native/0.63.4/react-native-0.63.4.pom
Required by:
    project :app

Command ./gradlew failed with exit code 1

Attempt 3 🚫

  • whilst having react-native installed in node_modules (nor specified in package.json)
  • with dependencies { implementation "com.facebook.react:react-native:0.63.4"; } in demo-react/App_Resources/Android/app.gradle
  • without any repositories specified in demo-react/App_Resources/Android/app.gradle.
Gradle build...
         + setting applicationId
         + applying user-defined configuration from /Users/jamie/Documents/git/react-native-in-nativescript/demo-react/App_Resources/Android/app.gradle
         + using android X library androidx.legacy:legacy-support-v4:1.0.0
         + adding nativescript runtime package dependency: nativescript-optimized-with-inspector
         + adding aar plugin dependency: /Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/core/platforms/android/widgets-release.aar
         + adding aar plugin dependency: /Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/detox/platforms/android/detox.aar

Build file '/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/platforms/android/app/build.gradle' line: 633
A problem occurred configuring project ':app'.
Could not find com.facebook.react:react-native:0.63.4.
Searched in the following locations:
  - https://dl.google.com/dl/android/maven2/com/facebook/react/react-native/0.63.4/react-native-0.63.4.pom
  - https://jcenter.bintray.com/com/facebook/react/react-native/0.63.4/react-native-0.63.4.pom
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/detox/Detox-android/com/facebook/react/react-native/0.63.4/react-native-0.63.4.pom
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/core/platforms/android/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/core/platforms/android/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/detox/platforms/android/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/detox/platforms/android/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/theme/platforms/android/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/theme/platforms/android/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/core/platforms/android/libs/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/core/platforms/android/libs/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/detox/platforms/android/libs/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/detox/platforms/android/libs/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/theme/platforms/android/libs/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/theme/platforms/android/libs/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/platforms/android/app/libs/runtime-libs/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/platforms/android/app/libs/runtime-libs/react-native.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/App_Resources/Android/libs/react-native-0.63.4.jar
  - file:/Users/jamie/Documents/git/react-native-in-nativescript/demo-react/App_Resources/Android/libs/react-native.jar
  - https://repo.maven.apache.org/maven2/com/facebook/react/react-native/0.63.4/react-native-0.63.4.pom
Required by:
    project :app

Command ./gradlew failed with exit code 1

Attempt 4 ✅

  • whilst having react-native installed in node_modules (nor specified in package.json)
  • with dependencies { implementation "com.facebook.react:react-native:0.63.4"; } in demo-react/App_Resources/Android/app.gradle
  • with the repositories specified in demo-react/App_Resources/Android/app.gradle. We're using maven { url("$rootDir/../../node_modules/react-native/android") } but not specifying the extra maven field about jsc-android.

To be clear, that's this:

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

android {
  defaultConfig {
    minSdkVersion 18
    generatedDensities = []
  }
  aaptOptions {
    additionalParameters "--no-version-vectors"
  }
}

dependencies {
  implementation "com.facebook.react:react-native:0.63.4";
}

Encouraging to see this line during the very brief build output:

Transforming artifact react-native-0.63.4.aar (com.facebook.react:react-native:0.63.4) with DexingWithClasspathTransform > DexingWithClasspathTransform jetified-react-native-0.63.4-runtime.jar

Successful build!

Gradle build...
         + setting applicationId
         + applying user-defined configuration from /Users/jamie/Documents/git/react-native-in-nativescript/demo-react/App_Resources/Android/app.gradle
         + using android X library androidx.legacy:legacy-support-v4:1.0.0
         + adding nativescript runtime package dependency: nativescript-optimized-with-inspector
         + adding aar plugin dependency: /Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/core/platforms/android/widgets-release.aar
         + adding aar plugin dependency: /Users/jamie/Documents/git/react-native-in-nativescript/demo-react/node_modules/@nativescript/detox/platforms/android/detox.aar
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Project successfully built.
The build result is located at: /Users/jamie/Documents/git/react-native-in-nativescript/demo-react/platforms/android/app/build/outputs/apk/debug/app-debug.apk

Now let's try running it...

@shirakaba
Copy link

shirakaba commented Feb 11, 2021

When having downloaded from the online repo (probably v0.12.2.4)

JS: binaryresource
JS: cache
JS: common
JS: catalyst
JS: react
JS: csslayout
JS: datasource
JS: drawable
JS: drawee
JS: imagepipeline
JS: fbcore
JS: imageformat
JS: imageutils
JS: infer
JS: jni
JS: perftest
JS: proguard
JS: quicklog
JS: soloader
JS: stetho
JS: systrace

When having included the v0.63.4 AAR from node_modules (Attempt 4)

JS: binaryresource
JS: cache
JS: common
JS: callercontext
JS: datasource
JS: debug
JS: drawable
JS: drawee
JS: imagepipeline
JS: fbcore
JS: fbreact
JS: react
JS: hermes
JS: jni
JS: imageformat
JS: imagepipelinebase
JS: imageutils
JS: infer
JS: nativefilters
JS: nativeimagetranscoder
JS: perftest
JS: proguard
JS: yoga
JS: soloader
JS: systrace
JS: widget

It's different! I've got yoga this time!!

@shirakaba
Copy link

shirakaba commented Feb 11, 2021

I've logged out all the runtime APIs (at least, all the ones I could find using my hasty recursive function):

https://gist.github.com/shirakaba/41492e23f7610609163ecec40f16d89b

🙂

The NativeScript runtimes team told me that, at least for iOS, though, that some of the APIs are lazy-loaded. So they may not all appear just by iterating over the objects – you'd have to call the selectors exactly to make them appear.

Still, though:

console.log(com.facebook.react.modules.systeminfo.ReactNativeVersion.VERSION);
console.log(com.facebook.react.BuildConfig.VERSION_NAME);
console.log(com.facebook.react.BuildConfig.VERSION_CODE);

... prints:

JS: {patch=4, major=0, minor=63, prerelease=null}
JS: 1.0
JS: 1

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