Tuesday, April 30, 2019

angular proxy config json not redirected to spring

we may face this error, when we try to hit from angular UI to back end java(Spring etc.,). The problem is with angular proxy conf json file. 

The configuration (Sample )should be ,

{
  "/api": {
    "target": "http://url.com",
    "secure": false,
    "changeOrigin": true,
    "pathRewrite": {"^/api" : ""}
  }
}

Here, "changeOrigin": true, is not mandatory if you are running in local host. means, both Cline and server both are running in same machine. But if it is different host, then changeOrigin is must. However we should need this at final production. So better set now itself.

Monday, April 8, 2019

The default Activity not found

Error : The default activity not found.

Solution:

1. Are you sure , your main activity is declared in Manifest xml ? If not , please declare and run app. It will work. Make sure only main activity name you can change. Other like Intent filter, you shoul not touch.

2. If above solution is not workout, try Run -> Edit Config-> Choose your correct activity or define default activity.

3. If above also not workout like you defined everything well, but still error coming. Please do File -> Invalidate cache and restart.

4. If above also not work, this is the final solution File -> Sync with Gradle. Definitely It will work.


Tuesday, April 2, 2019

Must declare the scalar variable @Po ...

We may get this sql exception error when dealing with sql query. I also faced this and after a big analysis , found two causes.

1. We did DB migration - So your case check any migration (version changes) happened.

2. Second issue - Syntax issue like space , name mismatch, declaring is wrong.


Thursday, March 21, 2019

Creating an array of objects in Java



1. Declaration
 A[ ] arr = new A[4];


 2. Initializing the Objects 

 arr[0] = new A();
 arr[1] = new A();
 arr[2] = new A();
 arr[3] = new A();

 3. Initializing via loop

 for( int i=0; i<4; i++ )
 arr[i] = new A();
 
 
 
 By java 8
 A[] a = Stream.generate(() -> new A()).limit(4).toArray(A[]::new);

Wednesday, February 20, 2019

Could not find method versioncode () for arguments 1.1 on defaultconfig

This problem came, when I tried to upload an apk to playstore with version changes. Means, I launched my second version and got this error.

Solution:

Go to you build.gradle(app) and make changes like below. It will work.
minSdkVersion 15targetSdkVersion 26versionCode 2.0.toInteger() // This is what I changed
versionName "2.0"