NativeScript platform add error - telerik

I am trying to add the android platform to my NativeScript project. When I run tns platform add android I get the following error: Package name must look like: com.company.Name
Here is my environment:
tns version 2.0.0,
node version 4.4.3,
tns doctor returns No issues were detected
Package name in project.json: com.mycompany.myproject
The error message has the Name with capital N. However if I try to use Myproject, the regex (^[^A-Z] + $) applied to the name does not validate.
Any suggestions are greatly appreciated.
Thank you.

Try opening the AndroidManifest.xml located in app/App_Resources/Android and putting your package name there under the <manifest> tag. Then run tns build android and see what happens. This should run just fine. If not, you might try getting a new app and see if something isn't borked on that project elsewhere causing this issue to bubble up. Hope that helps :)

Related

Newbie problems running example cordapp

I'm new to Corda, so am following the "Getting started developing CorDapps".
On my MacBook Pro, I have:
- installed the JDK, IntelliJ Community edition and Git,
- have downloaded the sample project (using git clone) by following Step One)
- created an IntelliJ project (by following Step Two)
but, when following instructions for Deploy the CorDapp locally (using ./gradlew clean deployNodes), I get the following errors:
Task :contracts-java:compileJava FAILED
/Users/samples/cordapp-example/contracts-java/src/main/java/com/example/state/IOUState.java:5: error: package com.google.common.collect does not exist
import com.google.common.collect.ImmutableList;
^
... and another 3 similar.
I've searched google, gradle and IntelliJ forums, but cannot find anyhting that helps resolve my issue.
Can someone point me in the right direction please?
Thanks a lot!
As recommended here, Open IOUState.java and:
Remove this import: import com.google.common.collect.ImmutableList;
Modify ImmutableList.of(new IOUSchemaV1()) to Arrays.asList(new IOUSchemaV1())
The recent 4.4 upgrades have removed the ImmutableList from the dependencies. You could change the ImmutableList.of to Arrays.asList or Collections.singletonList as a workaround.
Thanks for raising this, we will fix it ASAP.

Nativescript testing - tests/example.ts is missing from the TypeScript compilation

I have an Angular flavoured Nativescript project.
After follwoing the steps from https://docs.nativescript.org/tooling/testing/testing I encountered the following error:
ERROR in ./src/tests/example.ts Module build failed (from
../node_modules/#ngtools/webpack/src/index.js): Error:
/home/..../src/tests/example.ts is missing from the TypeScript
compilation. Please make sure it is in your tsconfig via the 'files'
or 'include' property.
The steps I did:
tns test init - enter on jasmine
npm i #types/jasmine --save-dev
started my android emulator
tns run android
You can see that the generated example test file does not work, but I did not read anything on the site about modifying the tsconfig.json.
One possible solution is to ... do exactly as the error message says.
after inserting this:
"include": ["src/tests/**/*.ts"]
to the tsconfig.json (or tsconfig.tns.json), the tests run without a problem.
Although I think this means, this file gets included in every build (not just test runs) so not the best solution yet. Including this line only in the tsconfig.spec.json did not help either, it seems I have to prepare a different build for production which will not include this.

Xamarin.UITest AppCenter Cannot find test-cloud.exe

I have created Xamarin.UITest that can run locally on my desktop. My goal is to execute these test as a part of a post-build script to run UITest after the app has built as mentioned in this article below:
https://tomsoderling.github.io/AppCenter-Automated-UI-tests-on-build/
Below is my script
appcenter test run uitest --app "MY-APP" --devices 168683d9 --app-path $APPCENTER_OUTPUT_DIRECTORY/MyApp.Mobile.Droid.apk --test-series "myapp-mobile-test" --locale "en_US" --build-dir $APPCENTER_SOURCE_DIRECTORY/MyApp.Mobile.UITests/bin/Release --token MY-TOKEN --uitest-tools-dir $APPCENTER_SOURCE_DIRECTORY/packages/Xamarin.UITest.*/tools
When the script above is apart of my appcenter post build script, I get the following error:
Error: Cannot find test-cloud.exe, the path specified by "--uitest-tools-dir" was not found.
Please check that "/Users/vsts/agent/2.141.1/work/1/s/packages/Xamarin.UITest.2.2.6/tools" is a valid directory and contains test-cloud.exe.
Minimum required version is "2.2.0".
I think a lot of people are having trouble dealing with this actually and I know it has something to do with --uitest-tools-dir OR --build-dir variables.
Keep in mind this I am first trying to do this with Xamarin.Android, if successful I will try the Xamarin.iOS
One clue i do see is when Tom says "I had to chose to build the app solution file in my App Center CI build - not simply the iOS project like I normally would" in the noted article, but I am not quite sure how to do that or if is connected to why AppCenter cannot locate my test-cloud.exe I will also say that test-cloud.exe somehow comes from the Xamarin.UITest nuget, but I do not see any test-cloud.exe file in my Xamarin.Forms project.
This answer works, but it's pretty fragile.
The test-cloud.exe can't be located at packages/Xamarin.UITest.2.X.X/tools in projects that uses the old project structure (projects that use packages.config). For new projects (new .csproj formats), there is no such file in the path of the project. The only way I found to make it work on AppCenter is to use it from the NuGet package cache (/Users/vsts/.nuget/packages/xamarin.uitest/2.X.X)
Kudos to AppCenter Agents for helping me to resolve this. 2 things were required as indicated below:
Agent Anvesh says
Hi there, Thanks for the details, So seems like you are using a nuget as a PackageReference in your project(this means that there will be no package folder in your project, packages will be there at user profile).
So when you are trying to run the test as part of the app center build. Then in the shell script used the --uitest-tools-dir value as below
/Users/vsts/.nuget/packages/xamarin.uitest/2.2.6/lib/tools
So I modified my above script to add the below:
--uitest-tools-dir /Users/vsts/.nuget/packages/xamarin.uitest/2.2.6/tools \
Agent Shawn says
So I added the below
msbuild $APPCENTER_SOURCE_DIRECTORY/MyApp.Mobile.UITestProject.csproj

After I added Sentry to react-native project, apps deployed to itunes store crash (on Android or ios simulator it works fine)

I added react-native-sentry to a react-native project. I followed this manual: https://docs.sentry.io/clients/react-native/
Everything worked fine on Android and ios emulator. But when I tried to archive an app in xcode I got this error.
React native symbol handling failed
The Sentry build step failed while running in the background. You can ignore this error or view details to attempt to resolve it. Ignoring it might cause your crashes not to be handled properly.
If I click 'Show Details; I get this
error: EOF while parsing a value at line 1 column 0
I followed the advice from here https://github.com/getsentry/react-native-sentry/issues/135 and edited Build Phases > Upload Debug Symbols so now there is only this line there
export SENTRY_PROPERTIES=sentry.properties
The error still persisted. So I decided to ignore it. In this case after I upload the version to Itunesconnect and install it with a TestFlight it crashes immediately on start.
If I run it on a simulator or install it directly an iphone it works fine.
It also works fine on Android.
Could you give me any advice what can be done to make it work on Apple Store too?
For me this error was signaled by Xcode because of some problems when running the build scrips.
Using:
https://github.com/getsentry/sentry-react-native
#sentry/react-native": "^1.0.9
I fixed it keeping the index.ios.js always in the root folder (before that I had it in a src folder and trying to use a custom build script to take it from src)
I set the build scripts in Xcode to be similar to the ones from sentry docs:
Build RN code and images script:
// sentry properties file located in `ios` folder
export NODE_BINARY=node
export SENTRY_PROPERTIES=sentry.properties
../node_modules/#sentry/cli/bin/sentry-cli react-native xcode \
../node_modules/react-native/scripts/react-native-xcode.sh
Upload debug symbols script:
I have this script as the last one in Build Phases
export SENTRY_PROPERTIES=sentry.properties
../node_modules/#sentry/cli/bin/sentry-cli upload-dif
"$DWARF_DSYM_FOLDER_PATH"
Note:
1) I haven't tried yet to move sentry.properties file as common for both android and iOS, placed in root folder (with import ../sentry.properties in scripts) but I think that should work too.
2) I used the terminal to test directly the release build:
react-native run-ios --configuration Release --simulator "iPhone 8"
or
react-native run-ios --configuration Release --device "Your Device Name"
In my case the reason was a space included in the name of the hard disk I use to keep the Project, Derived Data and Archives. Looks like the Sentry CLI script doesn't like spaces in the path to the project and it crashes there.
It was enough to rename the disk and update paths to Derived Data and Archives and all is well now.

PhpStorm: Can't analyse webpack.config.js: coding assistance will ignore module resolution rules in this file

The error started appearing at the start up of PhpStorm after I have upgraded to 2017.3.3
Webpack.config.js is a default one from Laravel 5.5 build.
Tried to suppress it with no success. Very annoying. Any ideas?
If you want to get rid of this problem you can remove the notifications & log for the Webpack from Settings->Apperance&Behavior->Notifications->Webpack
Common Cause:
There's an error in the Javascript used in your Webpack config when evaluated by IntelliJ.
But it works on the commandline?
It may work fine from the command line but the context that IntelliJ evaluates the config is different than the command line.
How can I tell what the Javascript error is?
Below the Can't analyse webpack.config.js error message, look for Error details:. If it's a Javascript error, this will give you a hint of what's failing.
Example:
I saw the following error when I opened a project in IntelliJ
Can't analyse webpack.config.js: coding assistance will ignore module resolution rules in this file.
Possible reasons: this file is not a valid webpack configuration file or its format is not currently supported by the IDE.
Error details: Cannot read property 'require' of undefined
In this case, there was a plugin configuration in the webpack.config.js using require.main.require. This is fine when ran from the command line but fails in IntelliJ because of the way IntelliJ evaluates the webpack.config.js. When IntelliJ evaluates it, require.main is undefined.
Just an workaround. This will make some changes to your project, but you can revert everything back to its original state after if PhpStorm works fine.
STEP 1
Make sure your git status is clean.
Close your PhpStorm.
Remove package-lock.json and node_modules.
Then regenerate package-lock.json with npm install.
Start PhpStorm and open your project.
Confirm that now it works. Event log like
Module resolution rules from webpack.config.js are now used for coding assistance.
STEP 2
Discard all changes with git checkout ..
Revert under node_modules with npm ci.
Now your project is before the workaround but with coding assistance.

Resources