Xamarin VS: Debugging first project does not show project on emulator - xamarin

Testing out Xamarin on Visual Studio 2017. I have an Android emulator running when I hit the debug to run the program, but my program does not appear on the emulator. Is there some connection issue? If so, where?
Deleting bin folders; creating new project to test; creating new emulator;
Here is the build output:
emulator: android_hw_fingerprint_init: fingerprint qemud listen service initialized
emulator: Warning: config.ini contains invalid skin.path entry: (null)
emulator: Warning: config.ini contains invalid skin.path entry: (null)
emulator: Adding boot property: 'ro.opengles.version' = '196608'
emulator: Adding boot property: 'qemu.sf.fake_camera' = 'back'
emulator: Adding boot property: 'qemu.adb.secure' = '1'
emulator: Adding boot property: 'dalvik.vm.heapsize' = '256m'
emulator: Adding boot property: 'qemu.hw.mainkeys' = '0'
emulator: Adding boot property: 'qemu.sf.lcd_density' = '420'
emulator: Adding boot property: 'monodroid.avdname' = 'my_device'
emulator: Adding boot property: 'qemu.timezone' = 'Unknown/Unknown'
emulator: _hwFingerprint_connect: connect finger print listen is called
audio: Failed to create voice `adc'
emulator: Warning: config.ini contains invalid skin.path entry: (null)
emulator: Warning: config.ini contains invalid skin.path entry: (null)
emulator: Warning: config.ini contains invalid skin.path entry: (null)
UpdateLayeredWindowIndirect failed for ptDst=(780, 216), size=(300x96), dirty=(300x96 0, 0) (A device attached to the system is not functioning.)
UpdateLayeredWindowIndirect failed for ptDst=(780, 216), size=(300x96), dirty=(300x96 0, 0) (A device attached to the system is not functioning.)

Related

Problem running an app on the iPhone with Xcode

Hello I am having some problems running my app on my iPhone when I run the app from me this error:
Xcode's output:
↳
error: unable to read property list from file: /Users/indumonta/AndroidStudioProjects/contagem_de_pessoas/ios/Runner/Info.plist: The operation couldn’t be completed. (XCBUtil.PropertyListConversionError error 1.) (in target 'Runner' from project 'Runner')
note: Using new build system
note: Planning build
note: Constructing build description
Could not build the precompiled application for the device.
Error launching application on Tigomes.
Terminal:
MBP-de-Luis:~ indumonta$ plutil Info.plist
Info.plist: file does not exist or is not readable or is not a regular file (Error Domain=NSCocoaErrorDomain Code=260 "The file “Info.plist” couldn’t be opened because there is no such file." UserInfo={NSFilePath=Info.plist, NSUnderlyingError=0x7fd621d04140 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}})
Can someone help me?
Open your project directory and run from within
flutter create contagem_de_pessoas
This should create the missing info.plist

NativeScript Failed resolving method create on class okhttp3.RequestBody

I'm using NativeScript 6.0 with Angular 8.0 and trying to use the nativescript-http-formdata plugin and keep running into a dependency issue;
LOG from device Galaxy S8: Error: java.lang.Exception: Failed resolving method create on class okhttp3.RequestBody
Full Error;
LOG from device Galaxy S8: Taken picture
LOG from device Galaxy S8: Gallery: /storage/emulated/0/DCIM/Camera/NSIMG_20190821_10221.jpg
LOG from device Galaxy S8: Saved: /data/user/0/org.nativescript.preview/files/NSIMG_20190821_10221_thumbnail.jpg
LOG from device Galaxy S8: com.tns.Runtime.resolveMethodOverload(Runtime.java:1201)
LOG from device Galaxy S8: com.tns.Runtime.callJSMethodNative(Native Method)
LOG from device Galaxy S8: com.tns.Runtime.callJSMethodImpl(Runtime.java:1122)
LOG from device Galaxy S8: com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1242)
LOG from device Galaxy S8: com.tns.Runtime.callJSMethod(Runtime.java:1109)
LOG from device Galaxy S8: com.tns.Runtime.callJSMethod(Runtime.java:1089)
LOG from device Galaxy S8: FILE: /data/user/0/org.nativescript.preview/files/NSIMG_20190821_10221_thumbnail.jpg
LOG from device Galaxy S8: Image saved successfully!
LOG from device Galaxy S8: Error: java.lang.Exception: Failed resolving method create on class okhttp3.RequestBody
LOG from device Galaxy S8: com.tns.Runtime.callJSMethod(Runtime.java:1081)
LOG from device Galaxy S8: com.tns.NativeScriptActivity.onActivityResult(NativeScriptActivity.java:54)
LOG from device Galaxy S8: android.app.Activity.dispatchActivityResult(Activity.java:7282)
LOG from device Galaxy S8: android.app.ActivityThread.deliverResults(ActivityThread.java:4516)
LOG from device Galaxy S8: android.app.ActivityThread.handleSendResult(ActivityThread.java:4563)
LOG from device Galaxy S8: android.app.ActivityThread.-wrap22(ActivityThread.java)
LOG from device Galaxy S8: android.app.ActivityThread$H.handleMessage(ActivityThread.java:1698)
LOG from device Galaxy S8: android.os.Handler.dispatchMessage(Handler.java:102)
LOG from device Galaxy S8: android.os.Looper.loop(Looper.java:154)
LOG from device Galaxy S8: android.app...
I'm using the nativescript-http-formdata plugin to send a photo
async sendPicture(filepath, imageAsset) {
var url = "http://localhost:9000/images/upload";
var name = filepath.substr(filepath.lastIndexOf("/") + 1);
// Get bitmap of file
const imageAndroidBitmap = android.graphics.BitmapFactory.decodeFile(filepath);
// Prepare the formdata
let fd = new TNSHttpFormData();
let param: TNSHttpFormDataParam = {
data: imageAndroidBitmap,
contentType: 'image/jpeg',
fileName: 'test.jpg',
parameterName: 'file1'
};
let params = [];
params.push(param);
try {
const response: TNSHttpFormDataResponse = await fd.post(url, params, {
headers: {}
});
console.log(response);
} catch (e) {
console.log(e);
}
}
I don't know how to get the okhttp3 dependency installed in NativeScript.
What I've tried so far
Did a 'tns update' just incase my packages were out of date.
Installed nativescript-https as someone said it satisfies the okhttp3 dependency problem
Installed nativescript-okhttp as it looks like the plugin I'm missing.
Update: Add dependency to app.gradle
Within /App_Resources/Android/app.gradle
// Add your native dependencies here:
// Uncomment to add recyclerview-v7 dependency
dependencies {
// implementation 'com.android.support:recyclerview-v7:+'
// https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
compile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.10.0'
}
// 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"
}
}
Then I restarted my preview
tns preview
Still getting the exact same error message.
Update: Use 6.0 branch of nativescript-http-formdata
Clone repo
cd ~/code/nativescript
git clone https://github.com/dotnetdreamer/nativescript-http-formdata.git
Get 6.0 branch
cd nativescript-http-formdata
git co 6.0
Install plugin directory
cd ~/code/AssetManagementPrototype
tns plugin install /home/map7/code/nativescript/nativescript-http-formdata/src
Run in emulator
tns run android --device emulator-5554
Error;
ERROR in /home/map7/code/nativescript/nativescript-http-formdata/src/TNSHttpFormData.ts
Module build failed (from ../node_modules/#ngtools/webpack/src/index.js):
Error: /home/map7/code/nativescript/nativescript-http-formdata/src/TNSHttpFormData.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
at NativeScriptAngularCompilerPlugin.getCompiledFile (/home/map7/code/AssetManagementPrototype/node_modules/#ngtools/webpack/src/angular_compiler_plugin.js:838:23)
at NativeScriptAngularCompilerPlugin.getCompiledFile (/home/map7/code/AssetManagementPrototype/node_modules/nativescript-dev-webpack/plugins/NativeScriptAngularCompilerPlugin.js:28:26)
at plugin.done.then (/home/map7/code/AssetManagementPrototype/node_modules/#ngtools/webpack/src/loader.js:41:31)
at process._tickCallback (internal/process/next_tick.js:68:7)
# ./app/home/home.component.ts 11:0-61 216:33-48
# ./app/home/home.module.ts
# ../$$_lazy_route_resource lazy namespace object
# ../node_modules/#angular/core/fesm5/core.js
# ./app/app.module.ts
# ./main.ts
Update: Try nativescript-http-formdata demo
This also failed, Ref: https://github.com/dotnetdreamer/nativescript-http-formdata/issues/19
You need to add that as dependency. For further reading you can refer here.
in Maven:
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.10.0</version>
</dependency>
in Gradle
// https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
compile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.10.0'
or
dependencies {
compile "com.squareup.okhttp3:okhttp:3.10.0"
}
As per the sample provided in their git repo, they adding in src/platforms/android/include.gradle
dependencies {
compile "com.squareup.okhttp3:okhttp:3.10.0"
}

How to fix cyrillic symbols path error in xamarin

I try to run fresh solution in xamarin but get an error "Unable to open file or read: Invalid argument".
I think that the problem is cyrillic user name. Is there a way to fix it without renaming user?
Error:
Severity Code Description Project File Line Suppression State
Error Unable to open file for read: Invalid argument HelloCrossPlatformWorld.Droid C:\Users\???????\AppData\Local\Temp\3lmzv4g2.pvd\manifest\AndroidManifest.xml
Output:
Starting runtime checks
Starting emulator Nexus_5X_API_28 ...
1>------ Build started: Project: HelloCrossPlatformWorld.Droid, Configuration: Debug Any CPU ------
C:\android\SDK\emulator\emulator.EXE -partition-size 512 -no-boot-anim -avd Nexus_5X_API_28 -prop monodroid.avdname=Nexus_5X_API_28
ERROR: resizing partition e2fsck failed with exit code 8emulator: WARNING: userdata partition is resized from 1 M to 2048 M
HAX is working and emulator runs in fast virt mode.
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-0c7d255f-7f0b-4ce7-a760-4dae02030c12-5340-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-0e3a40e7-e147-4ccc-b03c-cd98b7177a26-9860-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-10035f6b-dfc5-4e8a-918c-3e946b07dafb-1320-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-209243bb-de89-451c-9bc0-4a73ec160244-15848-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-30f48f7d-5e23-446e-9b1c-01a8ebf8d009-1332-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-3ab578be-f274-4fdc-bd59-a193eb4ee885-4188-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-43cbcfd5-87fa-4745-b344-87864ac452f9-100-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-49f1fada-3e7c-41a1-b230-c40b2418f32b-8668-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-4b1a0ab3-e7ed-4ae0-8414-28d2eed9881a-6940-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-4c0abb15-350e-4cad-b779-3a4f8e073c6e-10816-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-4c6a3df0-29f7-428b-ae99-c3e4b2c1160b-14012-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-4d871e93-b5cf-4b13-9a3b-622d8899174d-3956-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-56279d77-95dc-4c60-afb7-7be2701ed0e2-4052-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-56ee4e18-3d5b-4e0f-b6fe-bd690ee15f4b-14884-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-57376a39-7192-48e2-9641-08d50f302a2f-14216-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-5d8915da-10e6-435d-9164-6dbcb3c38497-15352-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-5fdb91d2-0a4a-40e5-9223-8dbb0f78e1c3-18260-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-6cd3a315-2d12-4e89-976a-dae74ef90670-4456-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-732f3b1d-b9e7-4481-83a4-230e904f9b42-15956-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-732f3b1d-b9e7-4481-83a4-230e904f9b42-15956-1001.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-80958925-8ba3-4949-a6b4-ff22214ae0f4-12244-0.open'
1>C:\Users\???????\AppData\Local\Temp\3lmzv4g2.pvd\manifest\AndroidManifest.xml : error APT0000: Unable to open file for read: Invalid argument
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
emulator: WARNING: Not saving state: emulator hasn't finished booting.
emulator: WARNING: (metrics) failed to rename an active log file 'C:\Users\Эдитный.android\metrics\spool\emulator-metrics-961b5120-9240-4028-b7b9-e4f383a1902f-13524-0.open'
emulator: WARNING: (metrics) failed to rename an abandoned log file 'emulator-metrics-961b5120-9240-4028-b7b9-e4f383a1902f-13524-0.open'
Emulator Nexus_5X_API_28 was stopped.
Runtime checks completed
Ok, I just reset the computer and changed the letters of the user name to Latin. Now it's works fine.

System.Net.Http.HttpRequestException exception will running th xamarin UI Test on Physical Device

I have created a simple Xamarin.Forms(Portable) project and included UI Test project in it. But when i am trying to run the test in physical device it giving me below mentioned exception.
Test Name: AppLaunches
Test Outcome: Failed
Result Message:
SetUp : System.Net.Http.HttpRequestException : An error occurred while sending the request.
----> System.Net.WebException : The underlying connection was closed: The connection was closed unexpectedly.
Result StandardOutput: Full log file: C:\Users\Admin\AppData\Local\Temp\uitest\log-2016-10-22_11-04-53-698.txt
Skipping IDE integration as important properties are configured. To force IDE integration, add .PreferIdeSettings() to ConfigureApp.
Android test running Xamarin.UITest version: 2.0.0.1534
Initializing Android app on device ZX1D63GCCL with installed app: co.veloxcore.UITestSample2
Signing apk with Xamarin keystore.
Skipping installation: Already installed.
Here is the link to my project: XamarinUITest
Log File : Error Log
Are you using using ModernHttpClient?
Also you can use Polly if you want to handle network exceptions.
For example:
conferences = await Policy
.Handle<WebException>()
.WaitAndRetry
(
retryCount:5,
sleepDurationProvider: retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt))
)
.ExecuteAsync(async () => await getConferencesTask);
Also AsyncErrorHandler is great tool to handle async exceptions

mobilefirst native ios keychain wrapper issue

I am working on a project for a native iOS app using xcode to develop the project, but including both MobileFirst Platform Foundation capabilities and mobile data capabilities from Bluemix. We are using a shared git repository on IBM DevOps services (jazzhub) to share project source code and work collaboratively on it.
Most of the native apps I have built in the past have been on my own, so this is my first attempt to collaborate using git/xcode working together.
All that is just context for the issue, which is a project using the above environment on my collegues mac build/runs fine. Once I git clone the project and try to run it on my mac I am getting the following error:
*** Assertion failure in -[KeychainItemWrapper writeToKeychain], /tmp/builds/bld-00-20141218-1823-2824648/worklight-ios/framework-xcode-project/NativeSDK-Sources/WorkLight/KeychainItemWrapper.m:311
2015-01-31 13:16:27.657 IBMBankNativeApp[88827:11348297] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Couldn't add the Keychain Item.'
Above this message in the xcode log I see a secussful initialization of the Bluemix and the call to initialize the MFP connection:
2015-01-31 13:16:27.439 NativeApp[88827:11348297] INFO: IBMBluemix initialization successful.
IBMBluemix SDK Version: 1.0.1.20141124-1240
BlueMix Target: https://mybank.mybluemix.net
applicationId: ea36d23f-....
2015-01-31 13:16:27.530 NativeApp[88827:11348297] IBMData SDK initialization successful.
2015-01-31 13:16:27.580 NativeApp[88827:11348297] ViewController - connectToServer - Initializing ...
2015-01-31 13:16:27.591 NativeApp[88827:11348297] [DEBUG] [WL_CONFIG] -[WLConfig init] in WLConfig.m:68 :: {
"application id" = NativeiOSApi;
"application version" = "1.0";
environment = iOSnative;
host = "192.168.0.17";
platformVersion = "6.3.0.00.20141218-1823";
port = 10080;
protocol = http;
wlServerContext = "/MFProject/";
wlUid = "wY/mbnwKTDDYQUvuQCdSgg==";
}
Before the MFP callback for initialization of the connection the application terminates with the keychain error.
I did not add the keychain access to the project, I'm using cocoapods to set-up bluemix support and wonder if that somehow is adding the keychain support?
I tried removing and running, removing then re-adding they keychain support in the project capabilities, all with the same error.
Is there something checked in and replicated by git that shouldn't be?
Thanks in advance!
Verify that the following Key exists under the Root key in both entitlements-debug.plist and entitlements-release.plist:
Key: keychain-access-groups
Type: Array
Inside the above Key:
Key: Item 0
Type: String
Value: $(AppIdentifierPrefix)worklight.group

Resources