Android-espresso (Kotlin): Saving bitmap by writeToTestStorage method - automated-tests

I try to make a screenshot test with Espresso:
Test
class ScreenshotTest {
#get:Rule
var nameRule = TestName()
#get:Rule
var mActivityTestRule = ActivityTestRule(MainActivity::class.java)
#Test
fun saveActivityBitmap() {
capture(mActivityTestRule.activity).bitmap.writeToTestStorage(nameRule.methodName)
}}
Manifest:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
but it failed with message:
No content provider registered for:
content://androidx.test.services.storage.outputfiles/saveActivityBitmap.png.
Are all test services apks installed?
It seems like necessary to tune ContentProvider...
Guys, may be anybody won this problem, or may be knows where is extensive documentation for writeToTestStorage method.
Google doesn't know about this and "developer.android.com" mentions about this method in release sheet only

I hope it would be helpful for someone.
I faced with similar problem on microsoft appcenter. The reason is appcenter does not support orchestrator.
This content provider is part of https://mvnrepository.com/artifact/androidx.test.services/test-services You should install orchestrator.apk and test-services.apk to run tests. When you run tests on your local emulator, gradle script does it for you, but appcenter does not

Related

Getting error can not access disposed object for builder.build() on visual studio update

I am getting error on debug session start on my dot net core API project; since I updated visual studio to latest version 17.1.1. Following is the exception detail, it is showing on console. I tried by deleting temp, bin, obj folders but nothing worked. Has somebody faced such an issue or know how to fix?
Unhandled exception. System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'ConfigurationManager'.
at Microsoft.Extensions.Configuration.ReferenceCountedProviderManager.AddProvider(IConfigurationProvider provider)
at Microsoft.Extensions.Configuration.ConfigurationManager.AddSource(IConfigurationSource source)
at Microsoft.Extensions.Configuration.ConfigurationManager.Microsoft.Extensions.Configuration.IConfigurationBuilder.Add(IConfigurationSource source)
at Microsoft.AspNetCore.Builder.WebApplicationBuilder.<>c__DisplayClass25_0.b__2(HostBuilderContext context, IServiceCollection services)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at Microsoft.AspNetCore.Builder.WebApplicationBuilder.Build()
at Program.$(String[] args) in Program.cs:line 40
It is because you use the old way of getting the settings from the configuration manager, like:
using (var serviceProvider = services.BuildServiceProvider())
{
...
}
If you remove these lines and just use the configuration as-is with
options = configuration.GetOptions<Object>("xxx");
it will work
we also had this issue since march 8.
is was introduced with the release of 6.0.3, see a github post about the issue : https://github.com/dotnet/aspnetcore/issues/40614
for now what we did is revert to the 6.0.2 version (this is a temporary work around, i will hope to figure out what was wrong asap)
for docker images:
FROM mcr.microsoft.com/dotnet/aspnet:6.0.2 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0.200 AS build
WORKDIR /src
if you are using it in yml also probably
use dotnetversion
DotNetVersion: "6.0.200" instead of "6.0.x"
6.0.200 is the sdk version of 6.0.2 framework https://dotnet.microsoft.com/en-us/download/dotnet/6.0
11/03/2022
see also this https://github.com/dotnet/core/issues/7259 were i have pinpointed the issue in our code and added a sample app to reproduce
if we look into that repo https://github.com/microsoft/ApplicationInsights-Kubernetes/blob/69f44c6ec3fda26d76a01836b851402e3f8a02ad/src/ApplicationInsights.Kubernetes/Extensions/ApplicationInsightsExtensions.cs
we indeed find the same piece of code on the other answers
i faced to this problem when i update my SDK both in docker and my window 11
my sdk is : 6.0.3
but i cant understand why this problem is happend

FlutterFirebaseCorePlugin.java uses or overrides a deprecated API

Ok so I run my program without importing firebase core, firebase auth and cloud firestore, and my code runs just fine but I register my app with firebase and it still runs fine but as soon as I import Firebase_auth, Firebase_core and cloud_Firestore... I get the following error
Note: C:\appflutter\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.7.0\android\src\main\java\io\flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\appflutter\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.16.0\android\src\main\java\io\flutter\plugins\firebase\firestore\streamhandler\TransactionStreamHandler.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
D8: Cannot fit requested classes in a single dex file (# methods: 89543 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Please help me.
I was having the same problem today and I found the solution here on Github
First, get the latest versions of your dependencies from pub.dev
Current latest versions are these:
firebase_auth: ^0.20.0+1
firebase_core: ^0.7.0
Then run these 3 commands in the terminal:
$ flutter pub upgrade
$ flutter pub get
$ flutter clean
And then run your project
$ flutter run
This will hopefully help you.
Seems it is a bug in Firebase plugins: https://github.com/FirebaseExtended/flutterfire/issues/3876. However setting min SDK to 23 does not show the warning.
it worked for me to change my sdkVersion to 23:
just go to android>app>build.gradle and
change the minSdkVersion-line in defaultConfig{} to .. minSdkVersion 23
$ flutter pub get
Just Do it in your Terminal it will work
Enable multidex in android project & run again.
I am suggesting this according to the last part of the error message you've posted.
According to this guide: https://firebase.flutter.dev/docs/installation/android#enabling-multidex
However, if your minSdkVersion is set to 20 or lower, then you must use the multidex support library and make the following modifications to your app project
In android - app - build.gradel file
add - implementation 'com.android.support:multidex:1.0.3' in dependencies section
add - multiDexEnabled true in default config section enter image description here
enter image description here
Suffered the error of FlutterFirebaseCorePlugin.java uses or overrides a deprecated API. for two days.
finally solved it by changing minSdkVersion to 21 in app/build.gradle and run the app with flutter run --no-sound-null-safety.
Found that the error comes from the sound null safety implementation which grey lists all incompatible API
There are two issues here, -Xlint and multidex.
For -Xlint, #Sarib's solution worked for me and both the -Xlint errors disappeared after running flutter pub upgrade, flutter pub get and flutter clean. You can find them under Tools > Flutter in Android Studio if you are not familiar with Terminal.
For multidex, according to the Android Studio User Guide, multidex is enabled by default if your minSdkVersion is 21 or higher. While #Joshi suggests enabling multidex, I think it is simpler to update the minSdkVersion in android/app/build.gradle file to 21 or higher, rather than mess with more variables and adding more dependencies, assuming you're building an app that targets Android21 or higher.
For this error:
Note: locationInD\flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
The solution I found was to replace this line in android/app/build.gradle:
implementation 'com.google.firebase:firebase-analytics-ktx'
with
implementation 'com.google.firebase:firebase-analytics'
For me i changed one of my implementation version from
implementation platform('com.google.firebase:firebase-bom:27.1.0') to
implementation platform('com.google.firebase:firebase-bom:26.6.0')
at the moment there are some bugs in this current version "27.1.0" and after running the application it worked
//To help someone my project needed this implementation for my ads #admob
change to minSdkVersion 24
in android/app/build.gradle
dependencies {
//add this in your dependencies
implementation "androidx.multidex:multidex:2.0.0"
}
then
$ flutter clean
$ flutter run
I had the same issue and combined two suggested fixes to get it to finally work:
minSdkVersion 21, change to 23
run "flutter pub upgrade"
= issues fixed!
To double-check what the fix was:
I also reverted back to 21 and invalidated + flutter clean and the issue appeared again. Then I changed to 23 and the warnings disappeared!
Check your minSDK, it works fine for 23

Problem importing FireBase Analytics into Unity

I have a project at Unity 2019.3 with dotnet 4.x. I am trying to import firebase analicts and I have gotten the following error:
System.TypeInitializationException: The type initializer for 'Firebase.Editor.Measurement' threw an exception. ---> System.MissingMethodException: void Google.EditorMeasurement.set_InstallSourceFilename(string)
--- End of inner exception stack trace ---
at Firebase.Editor.AndroidSettingsChecker..cctor () [0x0000c] in Z:\tmp\tmp.SHkOPK7iEJ\firebase\app\client\unity\editor\src\AndroidAPILevelChecker.cs:37
and
MissingMethodException: void Google.EditorMeasurement.set_InstallSourceFilename(string)
Does anyone have any idea what it could be? Was any library missing? I haven't found reference to this problem anywhere.
I had the exact same problem, I fixed it by fully removing the ExternalDependencyManager folder in the project and replaced it using the latest Jar Resolver plugin from here https://github.com/googlesamples/unity-jar-resolver/blob/master/external-dependency-manager-latest.unitypackage
At the same time I also installed Python 2.7 and added it to system path, but I'm pretty sure the jar resolver thing is what fixed the issue. The root problem is the embedded analytics (EditorMeasurement) fail and Firebase never executes the python scripts that make all the Plugins/Firebase/res/values xmls
Hope this helps! :)
In my case the issue was happening after adding a new Firebase package with a version bigger than the other Firebase packages already in the project. Updating all the packages to the same version solved the problem.
deleting the editor folder inside the PlayServicesResolver folder and then reimporting it from any of the firebase unity packages.

React Native - SQLite configuration error

First off, I tried to search for questions that kind of relates to the problem that I am facing, but alas no luck at all! If this question has been answered before, please do point me to it and sorry for the inconvenience.
Coming as a Cordova developer react-native sounds like a dream coming true but I am still a noob at it and am still learning it. I installed this SQLite plugin and followed every step for android development. But when I try to run the app on a simulator I always get the following error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> A problem occurred configuring project ':react-native-sqlite-storage'.
> failed to find Build Tools revision 23.0.1
The configurations that I did:
settings.gradle:
rootProject.name = 'todo'
include ':app'
include ':react-native-sqlite-storage'
project(':react-native-sqlite-storage').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sqlite-storage/src/android')
build.gradle:
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
[...]
MainApplication.java:
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new SQLitePluginPackage(this),
new MainReactPackage();
);
Thank you in advance.
there is another "build.gradle" file that you should config!
in your ".../node_modules/react-native-sqlite-storage/src/android/src/build.gradle"
change the build version on that file too!
set it with your build.gradle that already changed!
In your Android studio go to your SDK manager and find SDK tools tab. In there if you check the 'Show Package Details' you will find "Android SDK Build-Tools 23.0.1"
Install that and you are good to go :)

Cordova CLI 5.0.0 - JavaScript error BlankCordovaApp

I am using the JavaScript Blank Apache Cordova App. Changes were made to the config.xml only.
I changed the Cordova CLI in config.xml from 4.3.0 to 5.0.0. NPM downloaded the files, and no errors were reported.
When I F5 Debug > Android > Ripple. I get the following:
"Exception occurred". Uncaught Error: cordova already defined
This error does not appear when running 4.3.0. Any thoughts on why is would happen in 5.0.0?
Unfortunately this is a known issue with Ripple and the Android implementation in Cordova 5.0.0. The next point release will resolve it as the fix has been merged.
See the following dev mailing list thread on Cordova for details if you are interested: http://callback.markmail.org/message/so6xavs6xdfn45zv?q=+list:org%2Eapache%2Eincubator%2Ecallback-dev+Ripple
UPDATE: Cordova 5.1.1 is out and resolves this problem along with an Android security issue.
A bit late, but this usually works for me. For testing purposes (not only this case, but most of errors that sometimes occur in ripple) I always give it a first try, just like:
---->line 104 on cordova.js (which you can find inside platform www)
replace
if ("cordova" in window) { throw new Error("cordova already defined"); };
With:
if ("cordova" in window) {
//check if emulation
if(window.location.href.indexOf('localhost:4400') < 0){
//if not emulating, throw error
throw new Error("cordova already defined");
}
};
If it doesn't work, then I start googling about the issue.
hope this helps somebody to save some time.

Resources