How to fix 'No such module 'ReactNativeNavigation' error in swift ios project - react-native-navigation

I just implemented the ReactNativeNavigation library to my ios project using a swift AppDelegate file and when I build the project I get the error: 'No such module 'ReactNativeNavigation'
I have tried to install a previous version of the package and also tried to enable 'Copy only when installing' in the package itself.
My AppDelegate.swift file's parts using the package
import ReactNativeNavigation
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
let jsCodeLocation = RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index", fallbackResource: nil)
ReactNativeNavigation.bootstrap(jsCodeLocation, launchOptions: launchOptions)
return true
}
Has anyone met with this issue or knows how to fix it?
Thanks in advance!

I had a similar situation recently with swift and ReactNativeNavigation, I fixed it by:
Removing "import ReactNativeNavigation" from AppDelegate.swift
add "#import <ReactNativeNavigation/ReactNativeNavigation.h>" to your "project"-Bridge-Header.h
clear build cache and build again.

Related

Preferences library is causing E/libc & E/Pref errors

I'm building a weather app using MVVM and retrofit and i recently added a PreferencesFragmentCompat subclass to implement some user settings using the preferences lib. After doing so, my app won't run and i keep getting these few lines of errors :
2020-04-08 00:54:12.346 18079-18079/? E/de.flogaweathe: Unknown bits set in runtime_flags: 0x8000
2020-04-08 00:54:12.410 18079-18079/com.nesoinode.flogaweather E/libc: Access denied finding property "ro.vendor.df.effect.conflict"
2020-04-08 00:54:12.421 18079-18110/com.nesoinode.flogaweather E/Perf: Fail to get file list com.nesoinode.flogaweather
2020-04-08 00:54:12.421 18079-18110/com.nesoinode.flogaweather E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
2020-04-08 00:54:12.421 18079-18110/com.nesoinode.flogaweather E/Perf: Fail to get file list oat
2020-04-08 00:54:12.422 18079-18110/com.nesoinode.flogaweather E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
I've got no idea what these are and i can't find any specific answers on stack or google.There are no indications on what is causing the error so i can't figure out if i'm doing something wrong or if it is a library issue. Any ideas?
Here's the SettingsFragment where i'm adding the preferences from an xml resource file :
class SettingsFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResource(R.xml.settings_prefs)
}
}
And here's how i'm reading some values from the sharedPrefs:
class UnitProviderImpl(context: Context) : UnitProvider {
private val appContext = context.applicationContext
private val preferences:SharedPreferences
get() = PreferenceManager.getDefaultSharedPreferences(appContext)
override fun getUnitSystem(): String {
val selectedUnitSystemName = preferences.getString(UNIT_SYSTEM_KEY,
UnitSystem.SI.name.toLowerCase(Locale.ROOT))
return selectedUnitSystemName!!
}
}
I managed to figure out a solution to the issue after doing some more research. Firstly, i commented out all the code related to the preferences library (and the lib itself) and run the app again. The run was successful without any errors so that narrowed it down to the androidx.preference:preference-ktx:1.1.0 library itself since my code was reviewed and couldn't find any issues with it. Looking through the preference docs i figured i could try out a beta or alpha version that may have fixed this issue. And lo and behold, after using the androidx.preference:preference-ktx:1.1.0-beta01 beta version and uncommenting the relative code, everything worked once again.

Missing class: com.fasterxml.jackson.core.type.TypeReference. R8:Warning

After I updated Android Studio to 3.5, I am facing below warning whenever I build my Project.
Missing class: com.fasterxml.jackson.core.type.TypeReference
My project is using AndroidX. Here is the gist for my build.gradle(app)
https://gist.github.com/Arkar009/4ae5a05ff3435636bc605fee1fbdb050 . Can anyone know why this error occurs or alternative ideas to solve this error? Thanks in advances.
If you're super sure you will remember this line if you include Jackson later in your project, this does the trick (add it in your project's proguard-project.[txt|pro] file):
-dontwarn com.fasterxml.jackson.core.type.TypeReference
That class gets included somehow in the missing classes Set in R8 (I didn't go that far in R8's code), but you can skip the warning if you get that class in the list of patterns for "Don't Warn" rules (see com/android/tools/r8/R8.java):
List<ProguardConfigurationRule> synthesizedProguardRules = new ArrayList<>();
timing.begin("Strip unused code");
Set<DexType> classesToRetainInnerClassAttributeFor = null;
try {
Set<DexType> missingClasses = appView.appInfo().getMissingClasses();
missingClasses = filterMissingClasses(
missingClasses, options.getProguardConfiguration().getDontWarnPatterns());
if (!missingClasses.isEmpty()) {
missingClasses.forEach(
clazz -> {
options.reporter.warning(
new StringDiagnostic("Missing class: " + clazz.toSourceString()));
});
TBH, I was also bugged enough by this warning to get into R8, hope it helps!

Add a fa-icon in JHipster

My goal: use a fa-icon which as not been imported yet by JHipster
My try: add the fa-icon GrinHearts manually in the app.vendor.ts file using the following code and then run yarn run webpack:build command
/* after changing this file run 'yarn run webpack:build' */
/* tslint:disable */
import '../content/css/vendor.css';
// Imports all fontawesome core and solid icons
import { library } from '#fortawesome/fontawesome-svg-core';
import {
faUser,
faSort,
faSync,
faEye,
faBan,
faTimes,
faArrowLeft,
faSave,
faPlus,
faPencilAlt,
faBars,
faThList,
faUserPlus,
faRoad,
faTachometerAlt,
faHeart,
faList,
faBell,
faBook,
faHdd,
faFlag,
faWrench,
faClock,
faCloud,
faSignOutAlt,
faSignInAlt,
faCalendarAlt,
faSearch,
faTrashAlt,
faAsterisk,
faTasks,
faHome,
faGrinHearts
} from '#fortawesome/free-solid-svg-icons';
// Adds the SVG icon to the library so you can use it in your page
library.add(faUser);
library.add(faSort);
library.add(faSync);
library.add(faEye);
library.add(faBan);
library.add(faTimes);
library.add(faArrowLeft);
library.add(faSave);
library.add(faPlus);
library.add(faPencilAlt);
library.add(faBars);
library.add(faHome);
library.add(faThList);
library.add(faUserPlus);
library.add(faRoad);
library.add(faTachometerAlt);
library.add(faHeart);
library.add(faList);
library.add(faBell);
library.add(faTasks);
library.add(faBook);
library.add(faHdd);
library.add(faFlag);
library.add(faWrench);
library.add(faClock);
library.add(faCloud);
library.add(faSignOutAlt);
library.add(faSignInAlt);
library.add(faCalendarAlt);
library.add(faSearch);
library.add(faTrashAlt);
library.add(faAsterisk);
library.add(faGrinHearts);
// jhipster-needle-add-element-to-vendor - JHipster will add new menu items here
My issue: I get this error
ERROR in /src/main/webapp/app/vendor.ts
(41,5): Module '"/node_modules/#fortawesome/free-solid-svg-icons/index"' has no exported member 'faGrinHearts'.
Could somebody help me please?
Thanks!
You need to update your #fortawesome/free-solid-svg-icons package, the FaGrinHearts icon is not included in v5.1.0-8, only in v5.1.0+. I'd recommend using the latest version, which is v5.2.0. You can see the versions and the order they were released on npmjs

template 10 compiling error : 'PropertyChanged_ViewModel' does not exist in the current context.

i came from Microsoft course on edx, the template 10 is not working even after installing the NuGet Package, it gives me this error while compilling:
Error CS0103 The name 'PropertyChanged_ViewModel' does not exist in the current context.
and with double clicking on it, it takes me to the DetailPage.g.cs and the error is in this function :
public void UpdateChildListeners_ViewModel(global::solarizer.ViewModels.DetailPageViewModel obj)
{
if (obj != cache_ViewModel)
{
if (cache_ViewModel != null)
{
((global::System.ComponentModel.INotifyPropertyChanged)cache_ViewModel).PropertyChanged -= PropertyChanged_ViewModel;
cache_ViewModel = null;
}
if (obj != null)
{
cache_ViewModel = obj;
((global::System.ComponentModel.INotifyPropertyChanged)obj).PropertyChanged += PropertyChanged_ViewModel;
}
}
}
}
i deleted those if blocks and the error disappeared and the app ran but without the Hamburger Menu, any idea on how to fix this ??
Please consider updating the Template 10 Visual Studio Extension to at least version 1.7 and the NuGet package to at least 1.1.2. Then, create your project using the Hamburger template and let me know if it works.
takes me to the DetailPage.g.cs
Those .g.cs files are auto generated, and you shouldn't be modifying them. I think a clean build here would solve this issue, (especially after you've upgraded to a new version of T10)

Using Gradle execute for wix

I have a build.gradle that compiles my project, runs test creates a jar then packages that with launch4j. I want to be able to use wix to create a installer as well, however I seem to be having a lot of trouble launching it from .execute().
The files necessary for candle and light are held in \build\installer. However trying to access those files by calling execute in the build file is always met with failure.
I have made a second build.gradle in /build/installer that does work. It is:
task buildInstaller {
def command = project.rootDir.toString() + "//" +"LSML Setup.wxs"
def candleCommand = ['candle', command]
def candleProc = candleCommand.execute()
candleProc.waitFor()
def lightCommand = ['light' , '-ext', 'WixUIExtension', "LSML Setup.wixobj"]
def lightProc = lightCommand.execute()
}
Is there some way I can run the second build file from the main one and have it work or is there a way to call execute directly and have it work?
Thanks.
If your project consist of few gradle builds (gradle projects) you should use dependencies. Working with execute() method is a bad idea. I will do it in this way:
ROOT/candle/candle.gradle
task build(type: Exec) {
commandLine 'cmd', '/C', 'candle.exe', '...'
}
ROOT/app/build.gradle
task build(dependsOn: ':candle:build') {
println 'build candle'
}
ROOT/app/settings.gradle
include ':candle'
project(':candle').projectDir = "$rootDir/../candle" as File
BTW I had problems with Exec task so in my projects I replaced it with and.exec() so candle task may look like this:
task candle << {
def productWxsFile = new File(buildDir, "Product.wxs")
ant.exec(executable:candleExe, failonerror: false, resultproperty: 'candleRc') {
arg(value: '-out')
arg(value: buildDir.absolutePath+"\\")
arg(value: '-arch')
arg(value: 'x86')
arg(value: '-dInstallerDir='+installerDir)
arg(value: '-ext')
arg(value: wixHomeDir+"\\WixUtilExtension.dll")
arg(value: productWxsFile)
arg(value: dataWxsFile)
arg(value: '-v')
}
if (!ant.properties['candleRc'].equals('0')) {
throw new Exception('ant.exec failed rc: '+ant.properties['candleRc'])
}
}
More informations about multi projects you will find here http://www.gradle.org/docs/current/userguide/multi_project_builds.html.
The SetupBuilder plugin can do the job. It create the lauch4j launcher for your java application, signed it, create the msi file and signed it. You does not need to work with the complex WIX toolset syntax.

Resources