@@ -722,6 +722,26 @@ copyTypings.onlyIf({
722
722
generateTypescriptDefinitions. didWork;
723
723
})
724
724
725
+ task validateAppIdMatch {
726
+ doLast {
727
+ def packageJsonFile = new File (" $projectDir /../../package.json" );
728
+ def lineSeparator = System . getProperty(" line.separator" );
729
+
730
+ if (packageJsonFile. exists() && ! project. hasProperty(" release" )) {
731
+ String content = packageJsonFile. getText(" UTF-8" )
732
+ def jsonSlurper = new JsonSlurper ()
733
+ def packageJsonMap = jsonSlurper. parseText(content)
734
+
735
+ if (packageJsonMap. nativescript. id != android. defaultConfig. applicationId) {
736
+ def errorMessage = " ${ lineSeparator} WARNING: The Application identifier is different from the one inside 'package.json' file.$lineSeparator " +
737
+ " NativeScript CLI might not work properly.$lineSeparator " +
738
+ " Update the application identifier in package.json and app.gradle so that they match." ;
739
+ logger. error(errorMessage);
740
+ }
741
+ }
742
+ }
743
+ }
744
+
725
745
// //////////////////////////////////////////////////////////////////////////////////
726
746
// //////////////////////////// OPTIONAL TASKS //////////////////////////////////////
727
747
// //////////////////////////////////////////////////////////////////////////////////
@@ -802,6 +822,7 @@ task deleteGeneratedBindings(type: Delete) {
802
822
delete " $projectDir /src/main/java/com/tns/gen"
803
823
}
804
824
825
+ buildapk. finalizedBy(" validateAppIdMatch" );
805
826
deleteMetadata. dependsOn(" :asbg:clean" )
806
827
deleteFlavors. dependsOn(deleteMetadata)
807
828
deleteConfigurations. dependsOn(deleteFlavors)
0 commit comments