Thursday, May 17, 2012

Android : Solution "install parse failed no certificates"


When I am trying to install third party apk using ADB tool, I have faced "Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]" error.



To resolve the issue, I have followed few steps.
Open command prompt; Go to your debug.keystore location.
For eg:
 You can find the debug.keystore file in the following location
C:\Documents and Settings\User\.android
1.        Using Zip align copied apk.
zipalign -v 4 D:\Test.apk D:\Testc.apk
2.        keytool -genkey -v -keystore debug.keystore -alias sampleName -keyalg RSA -keysize 2048 -validity 20000
Now a prompt will ask for
  • Password
  • First and lastname
  • Name of Organization unit
  • Name of Organization
  • City
  • State
  • Country
After entering these fields we get our Certificate
3. 
jarsigner -verbose -keystore debug.keystore D:\Testc.apk sampleName

In some cases we need add -sigalg SHA1withRSA -digestalg SHA1 arguments to work out the step 3

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore debug.keystore D:\Testc.apk sampleName
Now it will ask for the password and then it will replace the apk with the signed one.

To check whether it is working or not, you can check using the following command.
jarsigner -verify D:\Testc.apk




Then I have installed apk using ADB.
Adb install D:\Testc.apk





Thanks for reading :)
If you have any other quick thoughts/hints that you think people will find useful, feel free to leave a comment.

Tuesday, May 8, 2012

Android :Ringing Bell (Pendulum Animation)

To achieve the pendulum animation, we need to have a animation xml file,which can be load in the code to perform pendulum animation.

pendulum.xml
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromDegrees="15" android:toDegrees="-15" android:pivotX="50%"
    android:pivotY="0%" android:duration="400" android:repeatMode="reverse"
    android:repeatCount="-1" />

MainActivity
public class MainActivity extends Activity {
    private View mPendulum;

    private Animation mAnimation;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.move);
        mPendulum = findViewById(R.id.pendulum);
        mAnimation = AnimationUtils.loadAnimation(this, R.animator.pendulum);
    }

    @Override
    public void onResume() {
        super.onResume();
        mPendulum.startAnimation(mAnimation);
    }
}

just run, we can have pendulum motion or ringing bell effect :)

Output

Source Code : Here

Tuesday, May 1, 2012