React-native on Android - cannot compile app - detox

I followed all the instructions to setup Android but when I try to compile it complains it cannot find the modules required in DetoxTest.java
/Work/mine/detoxJestRn/android/app/src/main/java/com/detoxjestrn/DetoxTest.java:3: error: package android.support.test.filters does not exist
import android.support.test.filters.LargeTest;
^
/Work/mine/detoxJestRn/android/app/src/main/java/com/detoxjestrn/DetoxTest.java:4: error: package android.support.test.rule does not exist
import android.support.test.rule.ActivityTestRule;
^`

You need to add the DetoxTest.java file in the correct folder (androidTest).
For example:
$ find android/app/src -name '*.java'
android/app/src/androidTest/java/com/[your.package]/DetoxTest.java
android/app/src/main/java/com/onova/[your.package]/MainActivity.java
android/app/src/main/java/com/onova/[your.package]/MainApplication.java

Related

Building C++ Pybind11 extension with setuptools and CMake generates .so directory

I am trying to use setuptools to install a C++ library with a Pybind11 interface using CMake. For using CMake with setuptools, I am using the code in the following answer: Extending setuptools extension to use CMake in setup.py?
I am able to build the library by hand with cmake.
Unfortunately however, when executing pip install . in the root directory of my project, the build fails.
While the first call to cmake (self.spawn(['cmake', str(cwd)] + cmake_args)) finishes without any error, executing the second call (self.spawn(['cmake', '--build', '.'] + build_args)) gives me the following error:
/users/thoerman/miniconda3/envs/postproc_np_products/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot open output file /users/thoerman/postproc_np_products/build/lib.linux-x86_64-cpython-37/postproc_ops_cpp.cpython-37m-x86_64-linux-gnu.so: Is a directory
collect2: error: ld returned 1 exit status
gmake[3]: *** [/users/thoerman/postproc_np_products/build/lib.linux-x86_64-cpython-37/postproc_ops_cpp.cpython-37m-x86_64-linux-gnu.so] Error 1
gmake[2]: *** [CMakeFiles/postproc_ops_cpp.dir/all] Error 2
gmake[1]: *** [CMakeFiles/postproc_ops_cpp.dir/rule] Error 2
gmake: *** [postproc_ops_cpp] Error 2
But when running the exact same commands on the command line inside the build_temp directory, everything works just fine.
Does anyone have a hint for me, what might be going wrong?
After further digging into the problem, I found the solution myself.
The problem was with the lines
extdir = pathlib.Path(self.get_ext_fullpath(ext.name))
extdir.mkdir(parents=True, exist_ok=True)
This created a directory for the target to be built. Building the target then failed, since there was already a directory with the same name.
I was able to solve it by replacing the second line as follows:
extdir.parent.mkdir(parents=True, exist_ok=True)

"Module build failed..." in Laravel Mix

I did not change anything in app.scss, but when I run npm run watch I get the following errors:
error in ./resources/sass/app.scss
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Unsupported operation: Cannot extract a file path from a URI with a fragment component
# ./resources/sass/app.scss 2:14-254
Asset Size Chunks Chunk Names
/js/app.js 2.46 MiB /js/app [emitted] /js/app
ERROR in ./resources/sass/app.scss
Module build failed (from ./node_modules/css-loader/index.js):
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/lib/loader.js):
undefined
^
Join(null, "variables"): part 0 was null, but part 1 was not.
#import 'variables';
^^^^^^^^^^^
stdin 2:9 root stylesheet
in C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\resources\sass\app.scss (line 2, column 9)
at runLoaders (C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\node_modules\webpack\lib\NormalModule.js:30
at C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\node_modules\loader-runner\lib\LoaderRunner.js:364:11
at C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\node_modules\loader-runner\lib\LoaderRunner.js:230:18
at context.callback (C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\node_modules\loader-runner\lib\Loader
13)
Any help appreciated.
Finally found the issue. It is related to dart-sass being used instead of node-sass with laravel-mix v4.x.x.
Turns out something related to dart-sass or laravel-mix does not work well with paths containing a '#' symbol. In your case, your app is located at C:\Users\TAQI VAHEED\Desktop\#Coding\resPro and the #Coding folder is creating the error.
Either move your app somewhere else without a '#' symbol in the path OR enable node-sass again by following the steps from laravel-mix 4.0.0 release notes:
you can manually switch back to node-sass, like so:
npm install node-sass
mix.sass('resources/sass/app.sass', 'public/css', {
implementation: require('node-sass')
});
in your webpack.mix.js write the code
mix.js('resources/js/app.js', 'public/js')
.postCss('resources/css/app.css', 'public/css');

module error not found on react

I'm following this tutorial for RxJS
but When I get to the part of setting up env, I get an error message when doing
$yarn run start
import * as Rx from "rxjs/Observable";
console.log(Rx);
if I leave the log without the "Rx", it shows fine.
But if I use the log... I get this error:
ERROR in ./node_modules/rxjs/Observable.js
Module not found: Error: Can't resolve 'rxjs-compat/Observable' in '/Users/manuel/Documents/testeos/JS/rxjs/node_modules/rxjs'
# ./node_modules/rxjs/Observable.js 6:9-42
# ./src/code.ts
# multi (webpack)-dev-server/client?http://localhost:8080 ./src/code.ts
I ran into the same issue today
Install yarn add rxjs-compat / npm install rxjs-compat
or
Do don't use deprecated imports: rxjs/Rx, rxjs/Observable, etc... (see new import paths)

python -m pip install urllib having systax error while installation of this module

here see what happened
when I run the above command cmd I get an error while installing. As you can see in the above image.
s.connect((base64.b64decode(rip),17620)
I get syntax error: invalid token in line 191
and it is also giving me problems on some other modules also.
s.connect((base64.b64decode(rip),17620)
I get syntax error: invalid token in line 191
(I ran into this myself using jupyter notebook)
As you are using python 3 you don't need to install URL lib as it is part of core https://github.com/python/cpython/tree/3.6/Lib/urllib/
It's submodules are restructured so you need to change python 2 code like
import urllib
...
urllib.urlopen
into
import urllib.request
...
urllib.request.urlopen

Install MatPlotLib 1.2.x on OS X Lion 10.7.4 and Python 3.2.2

I asked a question a couple of days ago regarding installing numpy on the same system. Thankfully, I managed to solve that one myself but unfortunately I am now stuck trying to install matplotlib.
I first of all tried the current distributed version but had no luck with that so I thought i would download the git repository and try that. I have got this far:
changed the make.osx file so that it will work in Python 3:
import urllib -> import urllib.request
urllib.urlretrieve() -> urllib.request.urlretrieve()
Even after that I still had a problem with it not finding the freetype2 headers. I googled around and discovered that I could solve this by editing a line in setupext.py:
'darwin' : [], -> 'darwin' : ['/usr/local'],
However, I still get an error message when using the make.osx file. Here is how I am calling the file from Terminal:
sudo make -f make.osx PREFIX=/usr/local PYVERSION=3.2 fetch deps mpl_build mpl_install
I realise that matplotlib isn't officially supported on Python 3 yet but I thought that maybe someone somewhere as at least managed to get it to compile/install?
Any help would be much appreciated,
Adam.
I have included the error I get below:
basedirlist is: ['/usr/local']
============================================================================
BUILDING MATPLOTLIB
matplotlib: 1.2.x
python: 3.2.2 (v3.2.2:137e45f15c0b, Sep 3 2011, 17:28:59)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
platform: darwin
REQUIRED DEPENDENCIES
numpy: 1.6.2rc1
freetype2: found, but unknown version (no pkg-config)
OPTIONAL BACKEND DEPENDENCIES
libpng: found, but unknown version (no pkg-config)
Tkinter: Tkinter: version not identified, Tk: 8.5, Tcl: 8.5
Gtk+: no
* Building for Gtk+ requires pygtk; you must be able
* to "import gtk" in your build/install environment
Mac OS X native: yes
Qt: no
Qt4: Qt: 4.7.4, PyQt4: 4.8.6
PySide: no
Cairo: no
OPTIONAL DATE/TIMEZONE DEPENDENCIES
datetime: present, version unknown
dateutil: matplotlib will provide
pytz: matplotlib will provide
adding pytz
OPTIONAL USETEX DEPENDENCIES
dvipng: no
ghostscript: /bin/sh: gs: command not found
latex: no
[Edit setup.cfg to suppress the above messages]
============================================================================
pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends', 'matplotlib.backends.qt4_editor', 'matplotlib.projections', 'matplotlib.testing', 'matplotlib.testing.jpl_units', 'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist', 'matplotlib.sphinxext', 'matplotlib.tri', 'matplotlib.delaunay', 'pytz', 'dateutil', 'dateutil.zoneinfo']
running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc -> build/lib.macosx-10.6-intel-3.2/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf -> build/lib.macosx-10.6-intel-3.2/matplotlib/mpl-data
running build_ext
building 'matplotlib.ft2font' extension
gcc-4.2 -DNDEBUG -g -O3 -arch i386 -arch x86_64 -I/usr/local/include -I/usr/local/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -DPYCXX_PYTHON_2TO3=1 -I/usr/local/include -I/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include -I/usr/local/include -I. -I/usr/local/include/freetype2 -I/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include/freetype2 -I/usr/local/include/freetype2 -I./freetype2 -I/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m -c src/ft2font.cpp -o build/temp.macosx-10.6-intel-3.2/src/ft2font.o
In file included from /Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m/bytearrayobject.h:9,
from /Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m/Python.h:73,
from ./CXX/WrapPython.h:58,
from ./CXX/Extensions.hxx:37,
from src/ft2font.h:6,
from src/ft2font.cpp:3:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/iosfwd:45,
from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/bits/stl_algobase.h:70,
from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/bits/char_traits.h:46,
from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/string:47,
from ./CXX/Python3/Exception.hxx:47,
from ./CXX/Python3/Objects.hxx:45,
from ./CXX/Python3/Extensions.hxx:52,
from ./CXX/Extensions.hxx:42,
from src/ft2font.h:6,
from src/ft2font.cpp:3:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/bits/c++locale.h: In function ‘int std::__convert_from_v(int* const&, char*, int, const char*, ...)’:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/bits/c++locale.h:77: error: ‘va_start’ was not declared in this scope
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/bits/c++locale.h:85: error: ‘va_end’ was not declared in this scope
In file included from /Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m/bytearrayobject.h:9,
from /Library/Frameworks/Python.framework/Versions/3.2/include/python3.2m/Python.h:73,
from ./CXX/WrapPython.h:58,
from ./CXX/Extensions.hxx:37,
from src/ft2font.h:6,
from src/ft2font.cpp:3:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/iosfwd:45,
from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/bits/stl_algobase.h:70,
from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/bits/char_traits.h:46,
from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/string:47,
from ./CXX/Python3/Exception.hxx:47,
from ./CXX/Python3/Objects.hxx:45,
from ./CXX/Python3/Extensions.hxx:52,
from ./CXX/Extensions.hxx:42,
from src/ft2font.h:6,
from src/ft2font.cpp:3:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/x86_64/bits/c++locale.h: In function ‘int std::__convert_from_v(int* const&, char*, int, const char*, ...)’:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/x86_64/bits/c++locale.h:77: error: ‘va_start’ was not declared in this scope
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/i686-apple-darwin11/x86_64/bits/c++locale.h:85: error: ‘va_end’ was not declared in this scope
lipo: can't figure out the architecture type of: /var/tmp//ccafJH1l.out
error: command 'gcc-4.2' failed with exit status 1
make: *** [mpl_build] Error 1
Okay...I think have managed to get matplotlib to install now...
First of all you need to install numpy. I have instructions to do this on another post: install numpy
Now open Terminal and clone the git repository for matplotlib (assumes you have git installed):
git clone git://github.com/matplotlib/matplotlib.git (this might take a while)
Once the clone is complete open your user folder in Finder
In your user folder open the matplotlib directory
There is a file called `make.osx' open this with TextEdit (or similar)
Change the following lines:
MACOSX_DEPLOYMENT_TARGET=10.6
OSX_SDK_VER=10.6
To:
MACOSX_DEPLOYMENT_TARGET=10.7
OSX_SDK_VER=10.7
Change the following lines:
${PYTHON} -c 'import urllib; urllib.urlretrieve("${ZLIBURL}", "${ZLIBFILE}")' &&\
${PYTHON} -c 'import urllib; urllib.urlretrieve("${PNGURL}", "${PNGFILE}")' &&\
${PYTHON} -c 'import urllib; urllib.urlretrieve("${FREETYPEURL}", "${FREETYPEFILE}")'
To:
${PYTHON} -c 'import urllib.request; urllib.request.urlretrieve("${ZLIBURL}", "${ZLIBFILE}")' &&\
${PYTHON} -c 'import urllib.request; urllib.request.urlretrieve("${PNGURL}", "${PNGFILE}")' &&\
${PYTHON} -c 'import urllib.request; urllib.request.urlretrieve("${FREETYPEURL}", "${FREETYPEFILE}")'
Save the changes
Open the file called setupext.py in idle
Find the line 'darwin' : [], and change it to 'darwin' : ['/usr/local'],
Save the file
Open Terminal again and type the following:
sudo make -f make.osx PREFIX=/usr/local PYVERSION=3.2 fetch deps mpl_build mpl_install
After some time matplotlib should be installed in the following directory:
/usr/local/lib/Python3.2/site-packages/
Open the above directory and also the following directory:
/Library/Python/3.2/site-packages/
Copy/move the following directories from /usr/local/lib/Python3.2/site-packages/ to /Library/Python/3.2/site-packages/:
dateutil
matplotlib
mpl_toolkits
matplotlib should be now installed
If you open idle and type import matplotlib it shouldn't return an error
I tried out the matplotlib/examples/user_interfaces/embedding_in_qt4_wtoolbar.py file and it seems works fine
Hope someone else finds this useful!
Thanks again for the assistance,
Adam.