嘿,我正在尝试对Ionic应用程序进行远程调试,它最近正在运行,但是现在该设备在Chrome Remote设备上显示,但是当我单击该设备时,该应用程序进程将不会显示。它将显示其他移动chrome选项卡上的进程,而不显示Ionic应用程序。
有什么线索吗?
我需要使用离子框架(v4)从 android 应用程序打印 html 内容。我在官方文档中找到了cordova-plugin-printer,但我无法让它工作。根据docs,您只需稍后安装插件和包装器。
ionic cordova plugin add cordova-plugin-printer
npm install @ionic-native/printer
Run Code Online (Sandbox Code Playgroud)
然后当注入打印机对象时,我收到 NullInjector 错误
ERROR Error: Uncaught (in promise): NullInjectorError: StaticInjectorError(AppModule)[TabComprobantePage -> Printer]:
StaticInjectorError(Platform: core)[TabComprobantePage -> Printer]:
NullInjectorError: No provider for Printer!
NullInjectorError: StaticInjectorError(AppModule)[TabComprobantePage -> Printer]:
StaticInjectorError(Platform: core)[TabComprobantePage -> Printer]:
NullInjectorError: No provider for Printer!
at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:725)
at resolveToken (core.js:11917)
at tryResolveToken (core.js:11861)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:11763)
at resolveToken (core.js:11917)
at tryResolveToken (core.js:11861)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:11763)
at resolveNgModuleDep (core.js:20233)
at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:20904)
at resolveNgModuleDep (core.js:20233)
at …Run Code Online (Sandbox Code Playgroud) android 构建时出错
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider;${applicationId}.bugshaker.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" ></meta-data>
</provider>
Run Code Online (Sandbox Code Playgroud)
错误信息是:
android\app\src\main\AndroidManifest.xml:39:13-41:65: AAPT: 错误: 找不到资源 xml/opener_paths (aka io.ionic.starter:xml/opener_paths)。
我正在尝试将我的应用程序从 Cordova 迁移到 Capacitor,但我仍然需要使用诸如后台地理定位之类的功能。为此,我正在使用这个插件:https : //ionicframework.com/docs/native/background-geolocation
所以,为了测试这个,我创建了一个新的应用程序,添加了 Capacitor 并安装了这个插件。如此处所述(https://github.com/ionic-team/capacitor/issues/2529#issuecomment-603205348),我将此行添加到我的字符串文件中:
<string name="mauron85_bgloc_account_name">@string/app_name</string>
<string name="mauron85_bgloc_account_type">$PACKAGE_NAME.account</string>
<string name="mauron85_bgloc_content_authority">$PACKAGE_NAME</string>
Run Code Online (Sandbox Code Playgroud)
在那之后,我跑了 npx cap sync
现在,每当我尝试构建应用程序时,都会收到以下错误:
Execution failed for task ':capacitor-cordova-android-plugins:compileDebugJavaWithJavac'.
在我的控制台中,上面有很多缺失的导入错误,如下所示:
C:\Users\zxy\Desktop\mobile_apps\testApp\android\capacitor-cordova-android-plugins\src\main\java\com\evgenii\jsevaluator\JsEvaluator.java:4: error: package android.support.annotation does not exist
import android.support.annotation.VisibleForTesting;
> C:\Users\zxy\Desktop\mobile_apps\testApp\android\capacitor-cordova-android-plugins\src\main\java\com\marianhello\bgloc\BackgroundGeolocationFacade.java:17: error: package android.support.v4.content does not exist
> import android.support.v4.content.ContextCompat;
> ^
> C:\Users\zxy\Desktop\mobile_apps\testApp\android\capacitor-cordova-android-plugins\src\main\java\com\marianhello\bgloc\BackgroundGeolocationFacade.java:18: error: package android.support.v4.content does not exist
> import android.support.v4.content.LocalBroadcastManager;
Run Code Online (Sandbox Code Playgroud)
知道如何让这个插件与 Capacitor 一起工作吗?
我正在为我的应用程序构建推送通知,但是当我在设备上运行我的应用程序时,我收到以下错误:
vendor-es2015.js:101693 Native: tried calling FCM.getToken, but the FCM plugin is not installed.
pluginWarn @ vendor-es2015.js:101693
vendor-es2015.js:101699 Install the FCM plugin: 'ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated'
pluginWarn @ vendor-es2015.js:101699
vendor-es2015.js:101693 Native: tried calling FCM.onNotification, but the FCM plugin is not installed.
pluginWarn @ vendor-es2015.js:101693
vendor-es2015.js:101699 Install the FCM plugin: 'ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated'
pluginWarn @ vendor-es2015.js:101699
vendor-es2015.js:101693 Native: tried calling FCM.onTokenRefresh, but the FCM plugin is not installed.
pluginWarn @ vendor-es2015.js:101693
vendor-es2015.js:101699 Install the FCM plugin: 'ionic cordova plugin …Run Code Online (Sandbox Code Playgroud) ionic : File C:\Users\Admin\AppData\Roaming\npm\ionic.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:1
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
Run Code Online (Sandbox Code Playgroud)
我正在尝试在 ionic 中构建构建时执行此操作,但该位置在 IOS 上并且不适用于 ionic 2 应用程序中的地理定位。
我已经安装了 ionic cordova plugin add cordova-plugin-geolocation 和
在 android 设备中,当位置服务打开时它正在工作。当定位服务关闭时,它不起作用。在 iOS 设备中,这两种情况都不起作用。需要一些帮助!!
import { Geolocation } from '@ionic-native/geolocation';
Run Code Online (Sandbox Code Playgroud)
在提供者中,我提到了地理定位;在 home.ts 中,我导入了 Geolocation。
要获取当前位置,我编写了以下代码
getCurrentLocation(){
this.geolocation.getCurrentPosition().then((position) => {
let loc = {
placeId: null,
name:null,
lat:null,
long:null,
}
var lat = position.coords.latitude;
var lng = position.coords.longitude;
var latlng = new google.maps.LatLng(lat, lng);
var geocoder = geocoder = new google.maps.Geocoder();
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试在底部工作表中添加列表,但是 ionic 给了我们一个数组,因此我们可以在那里添加类并为其设置样式。我想问的是我们如何制作一个列表或完全我们自己的 html 代码并将其传递给将显示的底部工作表函数?
async presentActionSheet() {
const actionSheet = await this.actionSheetController.create({
header: 'Albums',
buttons: [{
text: 'Delete',
role: 'destructive',
icon: 'trash',
handler: () => {
console.log('Delete clicked');
}
}, {
text: 'Share',
icon: 'share',
handler: () => {
console.log('Share clicked');
}
}, {
text: 'Play (open modal)',
icon: 'arrow-dropright-circle',
handler: () => {
console.log('Play clicked');
}
}, {
text: 'Favorite',
icon: 'heart',
handler: () => {
console.log('Favorite clicked');
}
}, {
text: 'Cancel',
icon: 'close',
role: 'cancel',
handler: …Run Code Online (Sandbox Code Playgroud) 当我尝试在 Android 上构建我的离子移动应用程序时,出现以下错误。
\nAn error occurred during the build:\nError: The target entry-point "@ionic-native/media-capture" has missing dependencies:\n - @ionic-native/core\n\n at TargetedEntryPointFinder.findEntryPoints (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder.js:40:23)\n at /Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@angular/compiler-cli/ngcc/src/execution/analyze_entry_points.js:28:41\n at SingleProcessExecutorSync.SingleProcessorExecutorBase.doExecute (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@angular/compiler-cli/ngcc/src/execution/single_process_executor.js:28:29)\n at /Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@angular/compiler-cli/ngcc/src/execution/single_process_executor.js:57:59\n at SyncLocker.lock (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@angular/compiler-cli/ngcc/src/locking/sync_locker.js:34:24)\n at SingleProcessExecutorSync.execute (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@angular/compiler-cli/ngcc/src/execution/single_process_executor.js:57:27)\n at Object.mainNgcc (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@angular/compiler-cli/ngcc/src/main.js:74:25)\n at Object.process (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@angular/compiler-cli/ngcc/index.js:29:23)\n at NgccProcessor.processModule (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@ngtools/webpack/src/ngcc_processor.js:163:16)\n at /Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@ngtools/webpack/src/ivy/host.js:55:18\n at /Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@ngtools/webpack/src/ivy/host.js:47:24\n at Array.map (<anonymous>)\n at Object.host.resolveModuleNames (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@ngtools/webpack/src/ivy/host.js:45:32)\n at actualResolveModuleNamesWorker (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/typescript/lib/typescript.js:102904:133)\n at resolveModuleNamesWorker (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/typescript/lib/typescript.js:103126:26)\n at resolveModuleNamesReusingOldState (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/typescript/lib/typescript.js:103200:24)\nAn unhandled exception occurred: The target entry-point "@ionic-native/media-capture" has missing dependencies:\n - @ionic-native/core\n\nSee "/private/var/folders/vp/8s5chkws6tx5v3wjyvr7n_qm0000gn/T/ng-HBL1kz/angular-errors.log" for further details.\nRun Code Online (Sandbox Code Playgroud)\n …