Posts

Showing posts from 2016

Error while launching the activity Android Studio

Hi ,
I am working with android studio with multiple applications, i got an issue after changing the package name and running the application through android studio. I could not able to run.....

I restarted the studio, but not resolved.

I followed these steps.

1. First remove the directory
~/.gradle/caches/ I am using mac, so open terminal,

rm -rf ~/.gradle/caches/ - It removes

2. Click on sync project with gradle files icon in android studio.

3. Run the project again.

It works for me.

ionic.bundle.js:26794 TypeError: $q.defer is not a function

ionic.bundle.js:26794 TypeError: $q.defer is not a functionvar defer = $q.defer();
1. Which framework is best for mobile hybrid application development
Angular
ionic
ionic 2
Score =
Correct answers:

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CordovaPlugin.privateInitialize(java.lang.String, org.apache.cordova.CordovaInterface, org.apache.cordova.CordovaWebView

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CordovaPlugin.privateInitialize(java.lang.String, org.apache.cordova.CordovaInterface, org.apache.cordova.CordovaWebView, org.apache.cordova.CordovaPreferences)' on a null object reference

Session 'android': Error Launching activity

Session 'android': Error Launching activity

set org.gradle.jvmargs=-Xmx1536M in the project gradle.properties

To run dex in process, the Gradle daemon needs a larger heap.
It currently has 1024 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to at least 1536 MB.
To do this set org.gradle.jvmargs=-Xmx1536M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html

Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
Error:Execution failed for task ':transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
Information:BUILD FAILED

Error running android: Instant Run requires 'Tools

Error running android: Instant Run requires 'Tools | Android | Enable ADB integration' to be enabled.


Android studio > Tools > Enable ADB integration

This will resolve the issues.

Unable to start the daemon process.-Android studio

Error:Failed to complete Gradle execution.

Cause:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0

FAILURE: Build failed with an exception.

* What went wrong:
Unable to create daemon log file

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Timeout waiting for endpoint response aws api gateway

Response Body{ "logref": "19960923-8472-11e6-a362-1f0b47fa1a56", "message": "Timeout waiting for endpoint response" }

"message": "Unknown endpoint error." AWS Api gateway

"message": "Unknown endpoint error."

Ssl issue -server rejected the handshake

I am trying to implement ssl,


The server rejected the handshake because the client downgraded to a lower TLS version than the server supports. Error code: SSL_ERROR_INAPPROPRIATE_FALLBACK_ALERT.

I didnt set certificate path to https. so got this error.


Api gateway - Api key- 403- "message": "Forbidden"

Aws api gateway with api giving the following error {"message": "Forbidden"} I am working with aws api gateway with nodejs as server. I defined my api using swagger yaml and  deployed to aws api gateway.
Next step is to implement authentication to the api.

Api gateway itself providing authentication mechanism.
Using api key to authenticate the request.

if API keys are enabled, you can set the x-api-key:{api_key} name/value pair here

If the api key is enabled for the api method, then you can set x-api-key: {api_key}  name/value pair in the header.

I used swgger ui and set the api key, but didnt work.
I resolved after few hours struggling.
Change frpm window.swaggerUi.api.clientAuthorizations.add( "bearer", apiKeyAuth ); with window.swaggerUi.api.clientAuthorizations.add( "jsonWebToken", apiKeyAuth );

The name you will assign to the ApiKeyAuthorization from client need to match the name you give the security scheme under swagger definitions.

Oracle database vs MongoDB

Oracle Database:

Oracle uses structured query language for database access.It will store data in tables.
It follows predefined schema and set up rules to govern the relationships.

MongoDB Database:

MongoDB stores data as JSON format. All the related information is stored together for faster data access.
At any time, you can change the structure of records by adding new fields.
It is a database which designed for big data storage and query.
It can gain its performance mainly by key value based design and easy to scale out
To achieve the performance and scalability, MongoDB ditches the transaction support.
We cannot use for transaction related applications like Payment gateway etc.

Both Oracle and MongoDB have a rich query language.
MongoDB is not meant to replace the relational databases.It simply fullfills the different needs.

QR Code Maximum payload/data

Maximum data qr code can store depends on the following factors.Data type,Number of pixels and error correction level.

 Numeric only - Maximum 7,089 characters (0,1,2...9)

 Alpha Numeric - Maximum 4,296 characters (0–9, A–Z [upper-case only], space, $, %, *, +, -, ., /, :)

 Binary/byte   - Maximum 2,953 characters.

Operators in Swift

Operators: An Operator a special symbol that tells the compiler to perform mathematical or logical operations.
Assignment Operator:
The assignment operator (a=b) initailizes or updates the vlaue of a with a vlue of b.
let b = 12 var a = 10 a = b  // a is now 12
Arithmetic Operators :

Swift supports 4 arithmetic operators.
Addition Subtraction Multiplication Division
Remainder Operator :
9 % 4 = 1
5 % 1.5 = 0.5


Comparison Operator :
Equal to (a == b) Not equal to (a != b) Greater than (a > b) less than (a < b)   .................etc
Ternary Conditional Operator :
Ternary conditional operator is a special operator with 3 parts.
question ? answer 1 : answer 2
if question { answer 1 } else { answer2 }

if question is true, it evaluates answer 1, otherwise, it evaluates answer 2.
Range Operators:
Closed Range Operator:
The closed range operator (a...b) defines a range from a to b,incluses vlues a and b.
ex:
  for index in 1...6 {   print("\(index) times 6 is \(index * 5)")   }   // 1 times 5 is 5   // 2 times 5…

Swift Basics

Swift is an Open Source, powerful language for mac OS, iOS. Swift 3 is the major release developed at Swift.org.

Declaring Constants :
let maximumMembers = 5 var minimumMembers = 2 let pi = 3.1416
Type Annotations :
var username: String username = "Srinivas Nidadavolu" println(username) // prints Srinivas Nidadavolu
Constant value cannot be changed.
var username = "SRINIVAS NIDADAVOLU" username = "KARUNA" // compile time error - username cannot be changed
Comments :
Comments in swift is similar to other programming languages like java, javascipt and c etc.
// for comment
/* this is also a comment*/
Semicolons: Swift doesnt need a semicolon (;) after every statement. Its optional. If your using multiple statements in the same line, then its required.
Data Types :
32 Bit and 64 bit platforms :
32 bit platform:
Int is Int32 UInt is UInt32
64 bit platform:
Int is Int64 UInt is UInt64
Booleans:
let userActive = true
if userActive{ println("user is active") }else{ println("user…

Push notifications - GCM- MismatchSenderId

{ multicast_id: 7577665675695298000,   success: 0,   failure: 1,   canonical_ids: 0,
  results: [ { error: 'MismatchSenderId' } ] }


{ multicast_id: 7058249237348086000,   success: 0,   failure: 1,   canonical_ids: 0,
  results: [ { error: 'InvalidRegistration' } ] }

StoryBoard ViewController -setting initial view

Image
Failed to instantiate the default view controller for UIMainStoryboardFile 'Main' - perhaps the designated entry point is not set?


Select the main viewcontroller, Select Attribute Inspector and set initial view. It is an entry point.
Error: [$interpolate:noconcat] Error while interpolating: {{url}}{{item.imageurl}}
Strict Contextual Escaping disallows interpolations that concatenate multiple expressions when a trusted value is required.  See
process.nextTick(function() { throw err; })                                       ^ MongoError: Error connecting to database: connection 1847 to localhost:27017 closed     at Function.MongoError.create (/node_modules/m

MEAN stack issue

(node) warning: possible EventEmitter memory leak detected. 11 reconnect listeners added. Use emitter.setMaxListeners() to increase limit.
Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file

guard init phantomjs-jasmine ERROR - Error is: No such file or directory @ rb_sysopen

RubyDep: WARNING: Your Ruby is outdated/buggy. (To disable warnings, set RUBY_DEP_GEM_SILENCE_WARNINGS=1)
RubyDep: WARNING: Your Ruby is: 2.3.0 (buggy). Recommendation: install 2.3.1.
21:47:06 - INFO - Writing new Guardfile to C:/Users/Guardfile
21:47:06 - INFO - Run 'gem install win32console' to use color on Windows
21:47:06 - ERROR - Could not load 'guard/phantomjs-jasmine' or '~/.guard/templates/phantomjs-jasmine' or find class Guard::Phantomjsjasmine
21:47:06 - ERROR - Error is: No such file or directory @ rb_sysopen - C:/Users/.guard/templates/phantomjs-jasmine

gem install guard-livereload on windows machine

gem install guard-livereload
ERROR:  Error installing guard-livereload:
        The 'http_parser.rb' native gem requires installed ........


use


gem install guard guard-livereload wdm

Ionic framework- facebook login- ReferenceError: Can't find variable: $q

I got an issue after integrating facebooking login,
for first time, app redirecting to facebook login and getting profile data , but second time, throwing this issue.

ReferenceError: Can't find variable: $q

Unable to install Cordova plugin- Failed to install 'cordova-plugin-camera':Error: EACCES: permission denied, open

npmERR! Error: EACCES: permission denied, symlink '../cordova/bin/cordova' -> '/Users/in074811/Documents/node_modules/.bin/cordova' npmERR!     at Error (native) npmERR!  { [Error: EACCES: permission denied, symlink '../cordova/bin/cordova' -> '/Users/in074811/Documents/node_modules/.bin/cordova'] npmERR!   errno: -13, npmERR!   code: 'EACCES', npmERR!   syscall: 'symlink',
npmERR!   path: '../cordova/bin/cordova',  Please try running this command again as root/Administrator.







followed these steps:


 npm i cordova@5.1.1 --g

Installing "cordova-plugin-camera" for android Fetching plugin "cordova-plugin-compat" via npm npmhttpGET https://registry.npmjs.org/cordova-plugin-compat npmhttp200 https://registry.npmjs.org/cordova-plugin-compat Fetching from npm failed: EACCES: permission denied, open '/Users/in074811/.npm/cordova-plugin-compat/1.0.0/package/.npmignore' Failed to install 'cordova-plugin-camera':Err…

ionic google signin decidePolicyForNavigationAction

WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSInvalidArgumentException> Your app is missing support for the following URL schemes: 

I am integrating google signin sdk with ionic. 

Solution:

Info.plist:

                   <key>CFBundleURLSchemes</key>
<array>
<string>fb266347933702779</string>
 <string>URL SCHEME</string>

</array>

this will resolve the issue.

Could not attach to pid:"27798"

unable to attach.
iphone simulator issue.


Solution:
 reset the Simulator content and settings will solve the issue.

Renamed Cordova Plugins from org.apache.cordova.device to cordova-plugin-device

Error: Registry returned 404 for GET on https://registry.npmjs.org/org.apache.cordova.device
Issue is due to Renamed Cordova Plugins  from org.apache.cordova.device to  cordova-plugin-device

Permission issue for ionic

Error: EACCES: permission denied, open '/Users/in074811/.cordova/lib/npm_cache/cordova-ios/4.1.1/package/.npmignore'
Error during untar for /.cordova/lib/npm_cache/cordova-ios/4.1.1/package.tgz: Error: EACCES: permission denied, open '/Users/in074811/.cordova/lib/npm_cache/cordova-ios/4.1.1/package/.npmignore' Error: Failed to fetch platform ios Probably this is either a connection problem, or platform spec is incorrect. Check your connection and platform name/version/URL.



Solution:
It may due to cache problem.

rm -rf ~/.cordova

The operation could'nt be completed.(LaunchServicesError error 0.)

The operation could'nt be completed.(LaunchServicesError error 0.)

Error: Start Page at 'www/index.html' was not found issue in xcode

Error: Start Page at 'www/index.html' was not found

I got this issue while building cordova based application for ios.
I resolved it by providing proper path to index.js

MongoDB Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused

mongo MongoDB shell version: 3.0.7 connecting to: test 2016-01-23T21:14:51.955+0530 W NETWORK  Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused 2016-01-23T21:14:51.957+0530 E QUERY    Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed     at connect (src/mongo/shell/mongo.js:179:14)     at (connect):1:6 at src/mongo/shell/mongo.js:179 exception: connect failed      [initandlisten] 

***aborting after invariant() failure


Solution:
Run mongodb with sufficient permissions.

$ sudo mongod