الكونسل وحدة مراقبة لاختبار التطبيق Console logs / Debug - الكوردوفا و الفون جاب
الكوردوفا و الفون جاب Phone Gap / Cordova
اى اكواد تستخدمها فى التطبيق يتطلب عمل لها اختبار او مراقبة عملها و ان كان هناك اخطاء بها ام لا
مع العلم قبل نشر التطبيق يجب حذفه , حيث جوجل لا تقبل بالسماح بتفعيل debug
بلوجن cordova plugin console
اكتب هذا الامر لتثبيت البلوجن
كود:
cordova plugin add cordova-plugin-console
ويجب وضع فى ملف index.js داخل function onDeviceReady الكود التالى
كود:
console.log("console.log works well");
طريقه عمله من خلال كروم.
-----------------------------------------------------------------------
جوجل كروم كونسل Google Chrome Console
-----------------------------------------------------------------------
اضغط R.CLick ثم اختر اخر اختيار Inspect او من الاختصار " Ctrl+ Shift+I "
ثم اختار تصنيف console ستجد جميع اخطاء التطبيق فى هذا الملف
ولكن هناك اخطاء تكون غير صحيحة لانها لا ينفع معها كونسل من خلال المتصفح فهى تعمل على الموبايل فقط
مثل هذا الملف.
ملف cordova.js :
كود:
index.html:26 GET file:///C:/riseapp/risecordova/app1/www/cordova.js net::ERR_FILE_NOT_FOUND
اقتباس:
you can not test your application on chrome. cordova.js file will be embedded after building the project. try building and deploying your app on the device or emulator.
نعم هذا الملف cordova.js غير موجود داخل www ولكن موجود داخل app1\platforms\android\platform_www
والذى عند عمل بناء build للتطبيق يدمج داخل apk
وبالتالى فهذا الملف سليم للموبايل و غير سليم بشكل وهمى للمتصفح لانه لا يفهمه
اقتباس:
if you want to avoid these errors goto /platforms folder. after building the project all your files and a copy of cordova.js are there. if you open your applications main page form that folder you wont get file not found error.
لات حدد مسار للملف واجعله فقط كما هو مظلل فى الاسفل
كود:
<script src="cordova.js"></script>
اقتباس:
When you run cordova platform add android and then cordova build android, you should get a cordova.js added project/platforms/android/assets/www folders. You don't need to add it in your js files. so, just declare it in index.js file as follows,
ملحوظة : اذا لم يعمل معك الكونسل بسبب سكيورتى و حظر راجع هذا الموضوع
الحماية والحظر سياسة أمان المحتوى CSP Content Security Policy - الكوردوفا و الفون جاب
المرجع:
https://cordova.apache.org/docs/en/l...ole/index.html
https://stackoverflow.com/questions/...dova-js-errors
https://stackoverflow.com/questions/...d-in-ionic-app