Couldn't find ionic.config.json file inside an ionic2 project - android

I m running the command : ionic platform add android , and I am inside and ionic2 project , and I have the ionic.config.json file in my app :
{
"name": "menu",
"app_id": "",
"v2": true,
"typescript": true
}
but I keep getting: Couldn't find ionic.config.json file. Are you in an Ionic project?
Any help please ?

Related

React-Native change default location of iOS and Android folder

According to the react-native cli documentation we can specify custom configuration based on each platform for RN cli.
I want to change the default location of each platform folders so I added my custom react-native.config.js to the root of the project which you can find here:
module.exports = {
project: {
ios: {
project: './example/ios/example.xcworkspace',
},
android: {
sourceDir: './example/android/',
},
},
};
If I run react-native config in the root folder, I can see the correct configuration:
{
...
"project": {
"ios": {
"sourceDir": "path-to-project-directory/example/ios",
"folder": "path-to-project-directory",
"pbxprojPath": "path-to-project-directory/example/ios/example.xcworkspace/project.pbxproj",
"podfile": "path-to-project-directory/example/ios/Podfile",
"podspecPath": null,
"projectPath": "path-to-project-directory/example/ios/example.xcworkspace",
"projectName": "example.xcworkspace",
"libraryFolder": "Libraries",
"sharedLibraries": [],
"plist": [],
"scriptPhases": []
},
"android": {
"sourceDir": "path-to-project-directory/example/android/",
"isFlat": true,
"folder": "path-to-project-directory",
"stringsPath": "path-to-project-directory/example/android/app/src/main/res/values/strings.xml",
"manifestPath": "path-to-project-directory/example/android/app/src/main/AndroidManifest.xml",
"buildGradlePath": "path-to-project-directory/example/android/build.gradle",
"settingsGradlePath": "path-to-project-directory/example/android/settings.gradle",
"assetsPath": "path-to-project-directory/example/android/app/src/main/assets",
"mainFilePath": "path-to-project-directory/example/android/app/src/main/java/com/example/MainApplication.java",
"packageName": "com.example",
"packageFolder": "com/example",
"appName": "app"
}
}
}
The problem is whenever I run react-native run-ios I get this error:
error iOS project folder not found. Are you sure this is a React Native project?. Run CLI with --verbose flag for more details.
NOTE: I installed all the dependencies properly. Here is the result of the react-native --v command:
react-native-cli: 2.0.1
react-native: 0.62.0
"react-native": "0.63.4"
For iOS you need to specify the --project-path prop in your run script, not in react-native.config.js
Your run script should look like this:
"ios": "react-native run-ios --project-path './<new folder>/ios'"
But after that you need to update paths to ../../node_modules/ located modules in a lot of native files like Podfile, ios/<your project name>.xcodeproj/project.pbxproj
You can check more here

Proxy setting in Ionic version 4+ for Android

I am developing hybrid app for Android using Ionic 5 in local environment and so I tried to set up the proxy config as following below.
In command line
$ ionic config set proxy http://myserver.com
changed ionic.config.json file:
{
"name": "appName",
"integrations": {
"capacitor": {},
"cordova": {}
},
"type": "angular",
"proxy": "http://myserver.com"
}
But it didn't work and please help me with this issue.
Note:
I know already proxy configuration for Angular project as below, but it didn't work in Android app.
"options": {
"browserTarget": "app:build",
"proxyConfig": "proxy.conf.json"
}

ReactNative: Uncaught TypeError: Cannot read property 'forEach' of undefined, while building KitchenSink demo

I am trying to compile a 'kitchen-sink' demo, for 'react-native':
NativeBase-KitchenSink
, and I have followed the following links already:
Solution to "React native: Android project not found. Maybe run react-native android first?"
Solution to "Expo : Cannot find a module LogReporter"
That is, from the installation of 'npm' till the installation of required tools using 'Yarn'.
And now I am stuck myself:
a. I run the command npm install in the 'root directory' of this project.
b. Then I run expo start, I see that the problems addressed in link 1 and 2 have gone away.
c. Then when the browser is up, I issue expo build:android
The following error shows up:
[11:14:44] Checking if current build exists...
[11:14:48] No currently active or previous builds for this project.
[11:14:50] Publishing to channel 'default'...
[11:14:56] Building iOS bundle
[11:15:09] Building Android bundle
[11:15:20] Analyzing assets
[11:15:27] Uploading assets
[11:15:27] No assets to upload, skipped.
[11:15:27] Processing asset bundle patterns:
[11:15:27] - D:\Projects\ReactNativeProjects\AwesomeProject\**\*
[11:15:27] Cannot read property 'forEach' of undefined
[11:15:27] TypeError: Cannot read property 'forEach' of undefined
at C:\xdl#51.4.0\src\Project.js:903:26
at Generator.next (<anonymous>)
at step (C:\Users\hp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\Project.js:2033:191)
at C:\Users\hp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\Project.js:2033:361
Please help me know where I am wrong? Some posts say the code is correct.
[EDIT]:
I also did a new thing in my 'app.json', just before executing command react-native eject, to create Android and iOS folders:
(Note: It is not mandatory to issue the react-native eject command, as this will cause permanent change according to the documentations)
{
"expo": {
"name": "AwesomeProject",
"description": "A Kitchen Sink project.",
"slug": "AwesomeProject",
"privacy": "public",
"sdkVersion": "30.0.0",
"platforms": [
"ios",
"android"
],
"ios": {
"supportsTablet": true
},
"android": {
"package": "com.abhsax.first"
},
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/logo.png",
"splash": {
"image": "./assets/splashscreen.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
]
},
"changes": "----below are the changes----",
"name": "AwesomeProject",
"displayName": "AwesomeProject"
}
That is, just when I added:
"name": "AwesomeProject",
"displayName": "AwesomeProject"
at the bottom of my 'app.json'
the command react-native eject started working, which was not working earlier, as the output was:
App name must be defined in the app.json config file to define the
project name. It must not contain any spaces or dashes.
Clearly, it is the hybrid of two different versions of the package managers: 'Expo' and 'npm'.
But the 'forEach' error in the concern here, did not go away.
Further efforts done were useless, so I am not putting them here.
I shall keep on trying until I figure it out.
you have to upgrade the expo cli version
do npm install -g expo-cli
and then expo start again
I resolved this by knowing that I was again mixing up with the package managers: 'npm' and 'yarn', and this time you do not need 'expo' for time being or all-together, so modify your 'app.json', removing expo section.
All I had to do was to issue the following commands in order.
Add React Base
yarn add react-base --save
Install Peer Dependencies
The peer dependencies included from any 'npm' packages does not automatically get installed. Your application will not depend on it explicitly.
react-native link
In the case of this demo project, one dependency was missing:
react-native link react-native-vector-icons
Start Yarn
yarn start
Run on android device or simulator.
react-native run-android
[Note:] Java 8 is recommended to be installed instead of higher versions of Java. see: What to install? Java 8 or Java 10
I wish it helps.
Happy coding :-)
Try changing:
"assetBundlePatterns": ["**/*"] to "assetBundlePatterns": ["assets/*"]
in your app.json file.

Typescript sourcemaps not displayed in Ionic 2 on an Android device

I face a weird Ionic2 behaviour.
When i deploy my app to a simulator, i can see the .ts file sourceMap in the chrome inspect debugger.
On both case, i use :
ionic run android
On the other side, when i deploy my apk on a real device, the tab "Sources" is completely different with an other groups of directories and, with no reference to my .ts files.
My environment is:
OS X 10.11
Ionic 2 2.0.0-beta.35
cordova 6.3.0
The project has been initially generated by:
ionic start biblio tutorial --v2
ionic.config.json
{
"name": "biblio",
"app_id": "",
"v2": true,
"typescript": true
}
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"emitDecoratorMetadata": true,
"experimentalDecorators": true
},
"filesGlob": [
"**/*.ts",
"!node_modules/**/*"
],
"exclude": [
"node_modules",
"typings/global",
"typings/global.d.ts"
],
"compileOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
Any ideas?
For me the problem was that when you're remote debugging on an android device, Chrome debugger cannot access the source map file on the device. The solution/fix is to include the source map inline. To do this I:
added the below to package.json in the root project directory
"config": {
"ionic_bundler": "webpack",
"ionic_source_map_type": "#inline-source-map"
},
This is to make the webpack to add source maps inline changed tsconfig.js line
"sourceMap": true,
to
"sourceMap": false
This is to disable typescript to create source map file since this is done by webpack.
After this change everything seems to be working fine. Note that this applies to ionic 2 RC_04

No cordova.local.properties file created by using cmd sencha cordova init com.mycompany.MyApp MyApp

I am executing this cmd
sencha cordova init com.mycompany.MyApp MyApp
cordova folder created but cordova.local.properties not appear
This is my app.json
"builds": {
"web": {"default": true},
"native": {
"packager": "cordova",
"cordova" : {
"config": {
// Uncomment the line below and add the platforms you wish to build for
//“platforms": "ios android wp8 blackberry”,
"id": "com.domain.HELLO123",
"name": "HELLO123"
}
}
}
Please tell me what step i am missing.I want to build remote build

Categories

Resources