Flow issue: "required module not found" - facebook

I am trying to add permissions module in our app, using
react-native-permissions#1.0.1
When i am trying to use it like this:
import Permissions from 'react-native-permissions'
During runtime, i got the following error:
file: 'file/RunTimePermissionsExample.js'
severity: 'Error'
message: 'react-native-permissions (Required module not found)'
at: '8,25'
source: 'flow'
Note
I had gone through these issue's:
https://github.com/facebook/flow/issues/2092,
https://github.com/facebook/flow/issues/3875,
Flow required module not found
and tried different methods suggested in them like:
Add this to .flowconfig under options:
module.name_mapper='(react-native-permissions)' -> 'empty/object'
Add this to .flowconfig under options
module.name_mapper='(react-native-permissions)' ->
'/flow/GeneralStub.js.flow'
Add this to .flowconfig under [lib]
declare module 'react-native-permissions' {
declare module.exports: any;
}
Unfortunately, the error is not resolved.
Additional Information
React Native version: ~0.48.4
React: 16.0.0
flow-bin: 0.38.0
eslint: 4.8.0,
babel-preset-flow: 6.23.0
Platform: [Android 5.1 and above]
Development Operating System: [Windows 7 Professional]
Dev tools: [ Android Studio version 2.3.2, Android SDK 23.1.2]

After some blind hits by rebuild, clean, reinstalling fixed the issue.

Related

MongoDB Realm React Native SDK with Expo - Missing Realm Constructor error

According to the latest documentation for MongoDB Realm React Native, it states that their SDK is compatible with Expo...
Expo now supports Realm with the Expo SDK version 44. To use Realm
with Expo, upgrade to Expo SDK version 44. Realm does not work with
earlier versions of Expo.
We have installed Expo and have the latest version of their SDK, however no matter what we try we get an error stating "Missing Ream Constructor":
We require the project to be in the Expo managed workflow and not the bare workflow. When we setup in bare workflow, it works.
Are we missing something??
Some of the settings I made to fix:
REMEMBER: react-native-reanimated doesn't work with Realm & Expo
Following the documentation
Rather than run with expo start or npx react-native [platform] run yarn android for iOS or yarn ios
Install Java SDK version 8
Uninstall react-native: npm uninstall -g react-native and run npx react-native run-android
If you got this error:
A problem occurred configuring project ':realm'.
Could not create task ':realm:compileDebugJavaWithJavac'.
Could not create task ':realm:forwardDebugPort'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\Users\yourUser\Desktop\Projects\MyAwesomeRealmApp\android\local.properties'.
`
To fix this:
Create a file with the name local.properties in android directory
Open the file and paste your Android SDK path like below: sdk.dir=C:\\Users\\UserName\\AppData\\Local\\Android\\sdk

How do you build iOS specific packages using SPM?

I am using Swift Package Manager that doesn't having a xcodeproject file associated with it and I get an error when building through he terminal. When I call the swift build command I get an error that the MacOS build failed. The package I'm building doesn't support MacOS (It uses UIKit), but only iOS. I can't figure out a way to call the command to only specify that the build is targeted for iOS. I've Google searched around with no luck. Does anybody know the correct syntax if it exists to build an SPM package for iOS from the terminal?
The version of Swift I'm using is: "Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)"
I have specified the platform in the Package.swift file
let package = Package(
name: "Package",
platforms: [.iOS(.v10), ],
products: [
...
I have created a sample project on github https://github.com/mike011/Swift-Package-Manager-Example. When I run swift build it fails with
/git/Swift-Package-Manager-Example/Sources/Swift-Package-Manager-Example/iOSSpecificFile.swift:9:8: error: no such module 'UIKit'
import UIKit
^
/git/Swift-Package-Manager-Example/Sources/Swift-Package-Manager-Example/iOSSpecificFile.swift:9:8: error: no such module 'UIKit'
import UIKit
^
I "solved" this by wrapping all my files in #if !os(macOS) #endif blocks. So the package builds on a Mac, but it doesn't have any content.
SwiftPM doesn't currently have a way to disallow building for a specific platform but if you want you can take advantage of the minimum build version to cause compile time errors on platforms you don't support.
For example if you don't want to allow building on macOS you can use the platform version: .macOS("99.0") in your platforms section of your manifest and you will be given the compilation warnings and errors similar to this when building in Xcode:
The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 99.0, but the range of supported deployment target versions is 10.8 to 10.16.99
Invalid Darwin version number: macos99.0
Invalid version number in 'target x86_64-apple-macos99.0'

ionic3 plugin and platform errors

I am using ionic CLI version 3.0.0-beta.5
When I am trying to install native plugins, I am getting these errors.
for example, installing social-sharing plugin
ionic plugin add cordova-plugin-x-socialsharing
and the error is
[ERROR] Unknown plugin: #ionic/cli-plugin-.
same error while adding platforms also..
C:\Users\varun\Desktop\apps\app>ionic platform add android
The platform command is no longer available. To find out more about the equivalent please run:
ionic cordova:platform --help
C:\Users\varun\Desktop\apps\app>ionic cordova:platform --help
[ERROR] Unable to find command: cordova:platform. It is possible that you are trying to get help on a project based command and you are not in a project directory.
Has anyone faced this problem? I am not getting enough information on official blog.
To fix "The platform command is no longer available" issue on Ionic3 beta 7 I tried the following:
ionic cordova:platform add android
However, it only worked for newly started projects so need to update ionic-scripts in your project.
Use this instead
cordova plugin add https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git
The repo name cordova-plugin-x-socialsharing is changed/missing
so, we can directly add plugin from plugin git repo.
shareWithOptions(option, successcallback, errorcallback);
Usage :
window.plugins.socialsharing.shareWithOptions( {
message: 'share this',
subject: 'the subject',
files: ['', ''],
url: 'https://www.gooogle.com',
chooserTitle: 'Pick an app'
},
function(success){
console.log(success);
},
function(err){
console.log(err);});

can't build with Ionic2

I'm developing an Ionic2 application and now I want to make a build but I get an error.
ionic info returns this:
Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.1
Ionic CLI Version: 2.1.1
Ionic App Lib Version: 2.1.1
Ionic App Scripts Version: 0.0.36
OS: Distributor ID: Ubuntu Description: Ubuntu 16.04.1 LTS
Node Version: v4.2.6
my main.prod.ts looks like this:
import { platformBrowser } from '#angular/platform-browser';
import { enableProdMode } from '#angular/core';
import { AppModuleNgFactory } from './app.module.ngfactory';
enableProdMode();
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
Everytime I try to do ionic build android I get this:
bundle failed: Could not resolve './app.module.ngfactory' from /home/xxx/Desktop/myApp/.tmp/app/main.prod.ts
ionic-app-script task: "build"
Ionic2 uses the Ahead-Of-Time-Compilation of Angular2 (by using ngc). What ngc does, is creating a factory out of your normal app-module and renames this module by adding NgFactory to the modules' Name.
So for example if you have an app-module called MySuperAwesomeApp, ngc creates a file which exports a factory called MySuperAwesomeAppNgFactory. And when building your Android app, ionic will search for MySuperAwesomeAppNgFactory instead of MySuperAwesomeApp, thus throwing an error, when not finding it.
In your case I suppose that you renamed your app-module (located in ./app.module.ts) but didn't change the factory name in the main.prod.ts.
For further reading on AOT, please refer to the Angular2 AOT Doc.

Android studio:import NDK project from eclipse

I exported project from Eclipse(windows) and imported it to android studio V 0.4.2(ubuntu).
The project include working NDK library.
I get this error when try to run my app:
Execution failed for task ':app:compileDebugNdk'.
NDK not configured
From others stackoverflow posts, I understand that it is an issue.
But get no workaround for this.
Should i proceed the development with eclipse for now, or is that the a lazy option ?
EDIT :
I run this command:
export NDK=~/Downloads/android-ndk-r9c
and then :
and then go to my app directory and run this:
ndk-build
And i get this:
yarinkos-u#yarinkosu-MSI-Notebook-EX600:~/AndroidStudioProjects/AndEngineEXperimental$ ndk-build
/home/yarinkos-u/Downloads/android-ndk-r9c/ndk-build: 1: /home/yarinkos-u/Downloads/android-ndk-r9c/ndk-build: dirname: not found
/home/yarinkos-u/Downloads/android-ndk-r9c/ndk-build: 132: /home/yarinkos-u/Downloads/android-ndk-r9c/ndk-build: uname: not found
ERROR: Unknown host operating system:
What i did wrong?
It seems that the script running,but i miss something there.
EDIT 2:
i mistakenly runing this also :
export PATH=~/Downloads/android-ndk-r9c
so i get the error above.
If i running onlt this :
export NDK=~/Downloads/android-ndk-r9c
I get ndk-build not found error.
NDK Support is introduced from Android Studio 0.4.1 only, so make sure you are running AS 0.4.1 or above.
Android gradle plugin must be 0.7.+ in build.gradle file and also new NDK integration requires NDK r9c .
Lines from Developer tools blog under Release 0.4.1
Supports importing NDK projects. If the imported project contains NDK
sources, these are imported into the jni/ source set of the project,
the module name is inferred from the Makefile and stored in the Gradle
file, and the ndk.dir property is defined in local.properties.
Check more about it here :
http://tools.android.com/recent
you need to download the NDK for your operatings system # https://developer.android.com/tools/sdk/ndk/index.html once it's downloaded, install it it'll extract the contents to the correct file system it needs to be in it'll take some time, also make sure you are running the latest android studio. it worked for me. good luck.