private String getApolloVersion ( ) { File packageFile = new File ( getProject ( ) . getBuildDir ( ) , INSTALL_DIR + "/package.json" ) ; if ( ! packageFile . isFile ( ) ) { return null ; } Moshi moshi = new Moshi . Builder ( ) . build ( ) ; JsonAdapter < PackageJson > adapter = moshi . adapter ( PackageJson . class ) ; try { PackageJson packageJson = adapter . fromJson ( Okio . buffer ( Okio . source ( packageFile ) ) ) ; return packageJson . version ; } catch ( IOException e ) { e . printStackTrace ( ) ; return null ; } }
Returns the locally install apollo - codegen version as found in the package . json file .