apsl / react-native-version-number Goto Github PK
View Code? Open in Web Editor NEWGets the version number and build number of your app.
License: MIT License
Gets the version number and build number of your app.
License: MIT License
Implement autolinking so users don't need to run react native link
for this dependency.
From RN CLI:
$ react-native run-ios
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
- react-native-version-number (to unlink run: "react-native unlink react-native-version-number")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
If the build is compiled using a flavor/build type with a different applicationId or a suffix is specified, the version returned is 1.0.
productFlavors { development { applicationIdSuffix ".development" } }
I'm trying to use react-native-version-number in my RN app. On iOS everything works, but on Android I get a redbox saying RNVersionNumber is undefined. Looking at my app's native android project I can see that it's not including the react-native-version-number native project at all. If I add it manually it'll fail on gradle sync with an error about the default configuration.
On further investigation, it seems that android studio (or rnpm/react-native-cli) is not able to recognize the react-native-version-number android project. It doesn't allow the submodule to be expanded when it's included in my app project and when opened directly in android studio it offers to setup gradle for the project.
Versions:
react-native-version-number: 0.3.0
react-native-cli: 2.0.1
react-native: 0.48.4
android studio: 3.0
react-native 0.49.3 generates a warning:
Module RNVersionNumber requires main queue setup since it overrides
constantsToExport
but doesn't implement `requiresMainQueueSetup. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
this library doesn't show app version in ExpoKit project
This code doesn't return anything:
console.log(VersionNumber.appVersion);
console.log(VersionNumber.buildVersion);
While trying to create apk file for anroid, its throwing following error.
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':react-native-version-number:verifyReleaseResources'.com.android.ide.common.process.ProcessException: Failed to execute aapt
How to fix this?
buildVersion
is typed as ?string
in the JS code.
https://github.com/APSL/react-native-version-number/blob/master/index.js#L7
type VersionObject = {
appVersion: ?string,
buildVersion: ?string,
bundleIdentifier: ?string
};
However, in the Android code, versionCode
from PackageInfo
is used, which is a Java int
https://developer.android.com/reference/android/content/pm/PackageInfo#versionCode
https://github.com/APSL/react-native-version-number/blob/master/android/src/main/java/com/apsl/versionnumber/RNVersionNumberModule.java#L41
constants.put(APP_BUILD, packageManager.getPackageInfo(packageName, 0).versionCode);
This usually doesn't present itself as a problem, but in some cases - such as when passing this value back across the bridge - there can be problems. Probably would be best to convert it to a string before passing it over the bridge the first time.
app/build.gradle
defaultConfig { applicationId "com.app.demo" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "0.1" multiDexEnabled true missingDimensionStrategy 'react-native-camera', 'general' missingDimensionStrategy 'store', 'play' }
instead of 0.1 they are showing 2097153
Here is code
import VersionNumber from 'react-native-version-number';
console.log('buildVersion', VersionNumber.buildVersion);
In the JavaScript code there is a default export, the type definition exports the values separately.
This results into an error if you deactivate "allowSyntheticDefaultImports" in the tsconfig.json.
The type definition should looks like:
declare module 'react-native-version-number' {
export default {
appVersion: string,
buildVersion: string,
bundleIdentifier: string
}
}
Hi I get this error after installing this package.
Changing the SDK build tools revision to 25.0.0 gives me the following error:
`AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027android:TextAppearance.Material.Widget.Button.Borderless.Colored\u0027.","sources":[{"file":"/Users/Pin/Desktop/Workspace-Official/MiFun/ReactNative/EthMall/node_modules/react-native-version-number/android/build/intermediates/res/merged/debug/values-v24/values-v24.xml","position":{"startLine":2}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027android:TextAppearance.Material.Widget.Button.Colored\u0027.","sources":[{"file":"/Users/Pin/Desktop/Workspace-Official/MiFun/ReactNative/EthMall/node_modules/react-native-version-number/android/build/intermediates/res/merged/debug/values-v24/values-v24.xml","position":{"startLine":3}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027android:keyboardNavigationCluster\u0027.","sources":[{"file":"/Users/Pin/Desktop/Workspace-Official/MiFun/ReactNative/EthMall/node_modules/react-native-version-number/android/build/intermediates/res/merged/debug/values-v26/values-v26.xml","position":{"startLine":14,"startColumn":20,"startOffset":832,"endColumn":53,"endOffset":865}}],"original":"","tool":"AAPT"}
/Users/Pin/Desktop/Workspace-Official/MiFun/ReactNative/EthMall/node_modules/react-native-version-number/android/build/intermediates/res/merged/debug/values-v24/values-v24.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
/Users/Pin/Desktop/Workspace-Official/MiFun/ReactNative/EthMall/node_modules/react-native-version-number/android/build/intermediates/res/merged/debug/values-v24/values-v24.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
/Users/Pin/Desktop/Workspace-Official/MiFun/ReactNative/EthMall/node_modules/react-native-version-number/android/build/intermediates/res/merged/debug/values-v26/values-v26.xml:15: error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
:react-native-version-number:processDebugResources FAILED
FAILURE: Build failed with an exception.
com.android.ide.common.process.ProcessException: Failed to execute aapt`
In a backwards-compatible way.
Hi
Please use config in "build.gradle" file like this:
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
android {
compileSdkVersion safeExtGet('compileSdkVersion', 26)
.......
}
.........
if i don't have buildToolsVersion 23.0.1 or sdk 23 when i release APK, i will receive some errors
Thanks
Step1. myapp
yarn add react-native-version --dev
Step2. package.json
+ "postversion": "react-native-version"
Step3.
npm version patch
Step4.
yarn android
error
version info
Expo CLI 4.4.1 environment info:
System:
OS: Windows 10 10.0.19042
Binaries:
Node: 15.11.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - C:\Users\Administrator\AppData\Roaming\npm\yarn.CMD
npm: 7.6.3 - C:\Program Files\nodejs\npm.CMD
SDKs:
Android SDK:
API Levels: 28, 29, 30
Build Tools: 28.0.3, 29.0.2, 30.0.3
System Images: android-28 | Intel x86 Atom_64, android-29 | Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom
IDEs:
Android Studio: Version 4.1.0.0 AI-201.8743.12.41.7042882
npmPackages:
expo: ~40.0.0 => 40.0.0
react: 16.13.1 => 16.13.1
react-dom: 16.13.1 => 16.13.1
react-native: 0.63.4 => 0.63.4
react-native-web: ~0.13.12 => 0.13.18
Expo Workflow: bare
Returns undefined when trying to print out version number on iOS device:
console.log('versionNumber ', VersionNumber)
{appVersion: undefined, buildVersion: undefined, bundleIdentifier: undefined}
Tested on iOS 11.4 iPhone 8 (simulator and device)
Trace:
Error: https://registry.yarnpkg.com/react-native-version-number/-/react-native-version-number-0.3.0.tgz: EACCES: permission denied, open '/Users/guyn/.yarn-cache/npm-react-native-version-number-0.3.0/.git/objects/01/77ba6e129d3bd819d70546e364976e699df8f9'
at Error (native)
I had to manually link it to MainApplication.java
import com.apsl.versionnumber.RNVersionNumberPackage; <-- add this
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new RNVersionNumberPackage(), <-- add this
new MainReactPackage()
);
}
`
When repeatedly performing npm install
with a dependency on react-native-version-number
, npm fails with the error code EISGIT
.
I have declared a dependency on on react-native-version-number
in my package.json like so:
...
"dependencies": {
"react-native-version-number": ">=0.2.0",
...
},
...
Performing npm install
for the first time succeeds. Performing npm install
immediately again will fail:
$ rm -rf node_modules/
$ npm install
$ <installation succeeds>
$
$ npm install
npm ERR! path <path/to/project/root>/node_modules/react-native-version-number
npm ERR! code EISGIT
npm ERR! git <path/to/project/root>/node_modules/react-native-version-number: Appears to be a git repo or submodule.
npm ERR! git <path/to/project/root>/node_modules/react-native-version-number
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.
When inspecting the installed react-native-version-number
module in node_modules
, I found that the module contains a .git
file.
Any help resolving this failure would be much appreciated. Thanks!
does any one have any clue why i'm getting this issue and how to fix it?
$ npm install
npm ERR! code EISGIT
npm ERR! path .............................................\node_modules\protractor-retry
npm ERR! git ..................................................\node_modules\protractor-retry: Appears to be a git repo or submodule.
npm ERR! git .........................................................................\node_modules\protractor-retry
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.
Just wondering if this project is dead. There are a few PRs open, but nothing has happened so far.
I mean information on how to use it on iOS can't be that hard to merge and should have been added from the start.
Ive installed all of the required plugins but in CeBuilder. Step 2 does not let me move forward. It doesnt recognize the installs.
Ive upgraded to SDK 37 and I get errors.
Package.json
{
"name": "listpro",
"version": "1.3.5",
"description": "ListPro",
"author": "InspireUI",
"private": true,
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"setup": "./scripts/setup.sh",
"detach": "./scripts/detach.sh",
"start": "expo start -c",
"postinstall": "patch-package"
},
"dependencies": {
"@appandflow/masonry-list": "^0.4.0",
"@babel/plugin-proposal-decorators": "^7.4.0",
"api-ecommerce": "0.0.29",
"axios": "^0.18.0",
"base-64": "^0.1.0",
"create-react-class": "^15.6.2",
"crypto-js": "^3.1.9-1",
"currency-formatter": "1.5.4",
"emoji-utils": "^1.0.1",
"expo": "^37.0.0",
"expo-analytics": "1.0.8",
"firebase": "6.0.2",
"hoist-non-react-statics": "3.3.0",
"html-entities": "^1.2.1",
"lodash": "^4.17.11",
"moment": "2.24.0",
"oauth-1.0a": "1.0.1",
"patch-package": "^6.1.2",
"postinstall-postinstall": "^2.0.0",
"prop-types": "15.7.2",
"react": "16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-37.0.0.tar.gz",
"react-native-animatable": "1.3.2",
"react-native-button": "2.4.0",
"react-native-collapsible": "^1.3.0",
"react-native-dates": "^2.0.4",
"react-native-dropdownalert": "3.11.0",
"react-native-gifted-chat": "0.8.2",
"react-native-google-places-autocomplete": "^1.3.9",
"react-native-invertible-scroll-view": "^1.1.0",
"react-native-keyboard-aware-scroll-view": "0.8.0",
"react-native-map-link": "2.4.0",
"react-native-modal-datetime-picker": "7.4.2",
"react-native-modalbox": "1.7.1",
"react-native-onboarding-component": "0.0.5",
"react-native-onesignal": "3.2.13",
"react-native-parallax-swiper": "^1.1.7",
"react-native-progress-bar-animated": "^1.0.6",
"react-native-render-html": "4.1.2",
"react-native-root-toast": "^3.0.2",
"react-native-safe-area-view": "0.14.3",
"react-native-scrollable-tab-view": "^0.10.0",
"react-native-slider": "0.11.0",
"react-native-snap-carousel": "3.7.5",
"react-native-swipe-list-view": "1.5.3",
"react-native-swiper": "^1.5.14",
"react-native-tab-view": "2.3.0",
"react-native-tag-select": "^2.0.0",
"react-native-textinput-effects": "0.5.1",
"react-native-timeago": "^0.4.0",
"react-native-vector-icons": "6.4.2",
"react-navigation": "^3.11.0",
"react-redux": "5.1.1",
"react-timer-mixin": "^0.13.3",
"react-tween-state": "^0.1.5",
"redux": "4.0.1",
"redux-persist": "^5.6.5",
"redux-thunk": "^2.2.0",
"sanitize-html": "1.20.1",
"schedule": "0.4.0",
"sentry-expo": "1.13.0",
"tcomb-form-native": "^0.6.20",
"urijs": "^1.19.0",
"url": "^0.11.0",
"util": "0.12.0",
"wpapi": "1.2.1",
"xdate": "^0.8.2",
"expo-ads-facebook": "~8.1.0",
"expo-localization": "~8.1.0"
},
"devDependencies": {
"@babel/core": "7.4.4",
"@babel/plugin-transform-runtime": "7.4.4",
"@babel/preset-env": "7.4.4",
"babel-jest": "24.8.0",
"babel-plugin-module-resolver": "3.2.0",
"babel-polyfill": "^6.26.0",
"babel-preset-expo": "^8.1.0",
"babel-preset-react-native": "4.0.1",
"path": "^0.12.7",
"reactotron-react-native": "3.5.2",
"reactotron-redux": "3.1.0"
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.