android {
...
testBuildType "deviceTest"
buildTypes {
debug {
// Using 10.0.2.2 (the desktop's localhost), as the app normally runs on an Emulator
// in debug mode.
buildConfigField "String", "BACKEND_URL", '"http://10.0.2.2"'
buildConfigField "Integer", "PORT", "8080"
applicationIdSuffix ".debug"
}
// Use local host for testing, for MockWebServer
deviceTest {
initWith debug
buildConfigField "String", "BACKEND_URL", '"http://localhost"'
}
release {
...
}
}
}
Run Code Online (Sandbox Code Playgroud)
酷似谷歌文档意味着这里.但是,这会导致测试依赖性(如JUnit)无法从单元测试中访问,因此测试无法运行.
我正在使用我的Mac网络摄像头在模拟器中模拟Android前置摄像头.不幸的是,相机似乎是横向的 - 截图,即使模拟器是纵向的.
请注意,相机在真实设备上表现正常(即它具有纵向).
My Emulator配置:Nexus 5X,Android Nougat 7.1.1,API Level 25,启动方向:纵向,前置摄像头:摄像头0,后置摄像头:仿真
如何以正确的方向使用网络摄像头?