我正在尝试构建一个 ionic 项目,当我尝试使用该命令时,
ionic capacitor run android
我收到一条错误消息,
[error] Unable to find node_modules/cordova-plugin-whitelist. Are you sure cordova-plugin-whitelist is installed?
[ERROR] An error occurred while running subprocess capacitor.
我已检查是否安装了cordova-plugin-whitelist,它是
Plugin "cordova-plugin-whitelist" already installed on android.
Adding cordova-plugin-whitelist to package.json
如何解决这个问题的?
我正在使用ionic 4.7.0.
我报告的问题发生在 Chrome 和 Firefox 上。
实际行为:
使用ion-select带有选项的大名单,当您打开警报,ion-select不会自动滚动到选定的值。用户看到选项列表中的第一个值,他可能认为没有选择任何内容
预期行为:
当警报打开时,视图会自动以所选值为中心
我创建了这个stackblitz来突出显示行为,我们可以在 stackblitz 上看到在加载视图时,选定的值是11:00但是当您打开警报(通过单击 ion-select)时,我希望视图会自动滚动选定的值。
这是离子选择的预期行为吗?
我发现了一些关于同一主题的问题,但没有什么能真正回答这个问题:
Ion-select 在 Ionic 3 中不滚动:这个给出了一个 CSS 的解决方案,它不能与 ionic 4 一起使用,因为 ionic 4 使用了不可修改的 web 组件
https://github.com/ionic-team/ionic-v3/issues/1005:一些带有 ion-select 的滚动错误,应该用 ionic 3.9.5 修复,所以我想这不是同一个问题
Ionic version: [x] 4.x
Current behavior: On iOS devices, the screen jumps to the top of the list when items are added to a list via the infinite scroll component.
This is not a problem on the web (Chrome or Safari) or on Android devices.

Expected behavior: The screen scroll should not be affected by adding items to a list. The user should see new posts appear and continue scrolling as normal.
Steps to reproduce:
对于我的项目,我使用Ionic了Angular. 当我的 ionic 项目第一次渲染时,加载时间太慢了。出现此问题是因为当项目first呈现时,加载所有js文件需要时间。那么我如何更快地加载“js”文件,这将提高我的离子项目的加载性能。如果有人知道加载时间慢得多的更好原因,请告诉我原因和解决方案。
我想在聚焦时ion-label在ion-itemwith内改变颜色ion-input。
我可以更改ion-itemusing的高亮颜色,--highlight-color-focused: yellow;但无法更改label颜色。
它将标签的默认颜色显示为主要颜色,但我想将其更改为“警告”,或者如果需要任何自定义颜色。
我已经尝试了以下解决方案,该解决方案在 Ionic github 存储库中提到过同样的问题,但没有解决我的问题。
https://github.com/ionic-team/ionic/issues/18531
以下代码我使用过
登录页面.html
<ion-content>
<div class="logo">
<div class="logoCenter">
<ion-icon name="sync"></ion-icon>
</div>
<h1 style="font-family: ProximaBold; color: white">Sample Application</h1>
</div>
<ion-grid style="margin-top: 10vh;">
<ion-row>
<ion-col size="12">
<ion-item>
<ion-label class="loginLabel" position="floating">Mobile No.</ion-label>
<ion-input type="number"></ion-input>
</ion-item>
<ion-item>
<ion-label class="loginLabel" position="floating">Password</ion-label>
<ion-input type="password"></ion-input>
</ion-item>
</ion-col>
</ion-row>
</ion-grid>
<ion-grid class="ion-padding">
<ion-row>
<ion-col class="ion-text-center" size="12">
<ion-button expand="full" shape="round" [routerLink]="['/home']">Submit</ion-button>
<p style="color: white;">Forgot Password?</p>
</ion-col>
</ion-row>
</ion-grid>
<p …Run Code Online (Sandbox Code Playgroud) 我正在运行我的 Ionic 4 应用程序ionic cordova run android,它在我的设备上构建和运行良好。
但是,现在我尝试通过运行来安装Firebase X:
ionic cordova plugin add cordova-plugin-firebasex
npm install @ionic-native/firebase-x
Run Code Online (Sandbox Code Playgroud)
然后我将此添加到我的app.module.ts:
import { FirebaseX } from '@ionic-native/firebase-x/ngx';
providers: [
FirebaseX,
]
Run Code Online (Sandbox Code Playgroud)
仅进行这些更改后,我运行ionic cordova run android,但它失败并且以下内容记录到控制台:
FAILURE:构建失败,出现异常。
出了什么问题:任务 ':app:transformDexArchiveWithExternalLibsDexMergerForDebug' 执行失败。
com.android.builder.dexing.DexArchiveMergerException:合并 dex 档案时出错:.dex 文件中的方法引用数不能超过 64K。在https://developer.android.com/tools/building/multidex.html了解如何解决此问题
Try:37 可操作任务:37 个已执行
使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。
- 在https://help.gradle.org获取更多帮助
BUILD FAILED in 25s C:\Users\damie\Documents\Ionic\my-mechanic\platforms\android\gradlew: 命令失败,退出代码 1 错误输出:注意:某些输入文件使用或覆盖已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以获取详细信息。注意:C:\Users\damie\Documents\Ionic\my-mechanic\platforms\android\app\src\main\java\org\apache\cordova\file\AssetFilesystem.java 使用未经检查或不安全的操作。注意:使用 -Xlint:unchecked 重新编译以获取详细信息。D8:无法在单个 …
从数据库获取值后,我试图将它放入一个变量中,但是当我这样做时,它给了我错误:
core.js:6014 ERROR Error: Uncaught (in promise): TypeError: Cannot set property 'userNm' of undefined
TypeError: Cannot set property 'userNm' of undefined
这是我的ts代码:
userNm: string ='';
ngOnInit(){
console.log("trying...");
firebase.firestore().collection(`Students`)
.where("authId", "==", this.userId)
.get()
.then(querySnapshot => {
querySnapshot.forEach(function(doc) {
console.log(doc.data().Name); // OK RESULT IN CONSOLE.LOG,NAME IS String in db.
this.userNm=doc.data().Name; // ERROR HERE
console.log(this.userNm)
console.log(doc.id, " ===> ", doc.data());
});
});
Run Code Online (Sandbox Code Playgroud)
控制台和数据库截图:
javascript typescript ionic-framework angular google-cloud-firestore
我正在尝试将我的应用程序从 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 一起工作吗?
我尝试开始一个新的离子项目。我做了这些步骤
1.npm install -g @ionic/cli
2.离子启动
我得到了与 npm 相关的错误。我搜索但找不到解决方案。
npm WARN 已弃用 request@2.88.2:请求已被弃用,请参阅https://github.com/request/request/issues/3142 npm WARN registryhttps://registry.npmjs.org/ 的意外警告:杂项警告 EINTEGRITY :想SHA512-F4TxbIf2Zho1u0gkwk7pMZkuAOcjie2Ifj9Txahek0JAUamP58o + 0YUlXp2xApo68CRZSFS4nMA5h897G2Q93A ==但得到SHA512-T7rpJR5srgZoHOMh8Kv1DDE6mbnW43SNUk9aRhPXGCfF2iJZoTEItjVYHC / gvtncRQCksb8Tk6f72HLaB6la0A ==:SHA512,F4TxbIf2Zho1u0gkwk7pMZkuAOcjie2Ifj9Txahek0JAUamP58o + 0YUlXp2xApo68CRZSFS4nMA5h897G2Q93A ==完整性校验和使用SHA512时失败。(50573 字节)npm WARN 注册表使用来自https://registry.npmjs.org/ 的陈旧数据由于重新验证期间的请求错误。npm WARN deprecated core-js@2.6.11: core-js@<3 不再维护,由于问题数量不推荐使用。请将您的依赖项升级到 core-js@3 的实际版本。npm 错误!cb() 从未调用过!
npm 错误!这是 npm 本身的错误。请在以下位置报告此错误:npm ERR! https://npm.community
npm 错误!可以在以下位置找到此运行的完整日志:npm ERR!C:\Users\Admin\AppData\Roaming\npm-cache_logs\2020-05-05T06_02_58_568Z-debug.log [ERROR] 运行子进程 npm 时出错。
我正在为我的应用程序构建推送通知,但是当我在设备上运行我的应用程序时,我收到以下错误:
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-framework ×10
ionic4 ×6
angular ×3
android ×2
cordova ×2
ionic-native ×2
angularjs ×1
capacitor ×1
firebase ×1
ion-select ×1
ionic2 ×1
ionic3 ×1
ionic5 ×1
javascript ×1
load-time ×1
npm ×1
pageload ×1
performance ×1
reactjs ×1
sass ×1
scroll ×1
typescript ×1