I have placed api jar file in libs folder.When I run this program,I'm getting Unfortunately,youtube player has stopped working.
Can anyone help me?
one more thing I want to know:
I have used this below statement in java file. it is showing redmark at DEVELOPER_KEY(actually this is a variable storing api key),
youTubeView.initialize(Config.DEVELOPER_KEY, this);
That is why i have used below statement:
youTubeView.initialize(DEVELOPER_KEY,this);
Is there any problem because of this
This is my activity.java
package com.example.XXX.XXX;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;
import com.google.android.youtube.player.YouTubeBaseActivity;
import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayer.PlayerStyle;
import com.google.android.youtube.player.YouTubePlayerView;
public class YoutubeActivity extends YouTubeBaseActivity implements
YouTubePlayer.OnInitializedListener {
public static final String DEVELOPER_KEY = "<Censored>";
public static final String YOUTUBE_VIDEO_CODE = "uOpVvokKnu0";
private static final int RECOVERY_DIALOG_REQUEST = 1;
// YouTube player view
private YouTubePlayerView youTubeView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
youTubeView = (YouTubePlayerView) findViewById(R.id.youtube_view);
// Initializing video player with developer key
youTubeView.initialize(DEVELOPER_KEY,this);
}
#Override
public void onInitializationFailure(YouTubePlayer.Provider provider,
YouTubeInitializationResult errorReason) {
if (errorReason.isUserRecoverableError()) {
errorReason.getErrorDialog(this, RECOVERY_DIALOG_REQUEST).show();
} else {
String errorMessage = String.format(
getString(R.string.error_player), errorReason.toString());
Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show();
}
}
#Override
public void onInitializationSuccess(YouTubePlayer.Provider provider,
YouTubePlayer player, boolean wasRestored) {
if (!wasRestored) {
// loadVideo() will auto play video
// Use cueVideo() method, if you don't want to play it automatically
player.loadVideo(YOUTUBE_VIDEO_CODE);
// Hiding player controls
player.setPlayerStyle(PlayerStyle.CHROMELESS);
}
}
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == RECOVERY_DIALOG_REQUEST) {
// Retry initialization if user performed a recovery action
getYouTubePlayerProvider().initialize(DEVELOPER_KEY,this);
}
}
private YouTubePlayer.Provider getYouTubePlayerProvider() {
return (YouTubePlayerView) findViewById(R.id.youtube_view);
}
}
`
This is my XML code
`
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
android:scaleType="centerCrop"
android:src="#drawable/snake_bg" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/rouned_corner_shadow"
android:gravity="center_horizontal"
android:orientation="vertical" >
<com.google.android.youtube.player.YouTubePlayerView
android:id="#+id/youtube_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="70dp"
android:layout_marginBottom="20dp"
android:scaleType="fitCenter"
android:src="#drawable/nat_geo_logo" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="#string/title_logo"
android:textColor="#color/title"
android:textSize="20dp"
android:textStyle="bold" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginBottom="30dp"
android:scaleType="fitCenter"
android:src="#drawable/wild" />
</LinearLayout>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:background="#drawable/rouned_corner_shadow"
android:text="#string/btn_skip_intro" />
</LinearLayout>
</RelativeLayout>
`
Log cat output:
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.example.health.weshallovercome.YoutubeActivity.onCreate(YoutubeActivity.java:38)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Because of this below code I'm getting some errors on design view. I'll attach that.
<com.google.android.youtube.player.YouTubePlayerView
android:id="#+id/youtube_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp" />
Please find the logcat:
05-04 06:24:29.670 935-935/XXX D/dalvikvm﹕ Not late-enabling CheckJNI (already on)
05-04 06:24:31.580 935-935/XXX D/dalvikvm﹕ GC_FOR_ALLOC freed 48K, 5% free 2808K/2940K, paused 248ms, total 333ms
05-04 06:24:31.580 935-935/XXX I/dalvikvm-heap﹕ Grow heap (frag case) to 9.002MB for 6480016-byte allocation
05-04 06:24:32.030 935-944/XXX D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 2% free 9136K/9272K, paused 453ms, total 453ms
05-04 06:24:33.410 935-935/XXX D/﹕ HostConnection::get() New Host Connection established 0xb7550c78, tid 935
05-04 06:24:33.550 935-935/XXX W/EGL_emulation﹕ eglSurfaceAttrib not implemented
05-04 06:24:33.570 935-935/XXX D/OpenGLRenderer﹕ Enabling debug mode 0
05-04 06:28:24.979 935-935/XXX W/EGL_emulation﹕ eglSurfaceAttrib not implemented
05-04 06:28:27.559 935-935/XXX D/dalvikvm﹕ GC_FOR_ALLOC freed 29K, 2% free 11093K/11216K, paused 41ms, total 42ms
05-04 06:28:27.769 935-935/XXX W/EGL_emulation﹕ eglSurfaceAttrib not implemented
05-04 06:28:30.839 935-935/XXX D/AndroidRuntime﹕ Shutting down VM
05-04 06:28:30.839 935-935/XXX W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb3ab8ba8)
05-04 06:28:30.869 935-935/XXX E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: XXX, PID: 935
java.lang.RuntimeException: Unable to start activity ComponentInfo{XXX/XXX.YoutubeActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at XXX.YoutubeActivity.onCreate(YoutubeActivity.java:38)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
05-04 06:28:35.489 935-935/XXX I/Process﹕ Sending signal. PID: 935 SIG: 9
05-04 06:28:36.699 1148-1148/XXX D/dalvikvm﹕ GC_FOR_ALLOC freed 40K, 5% free 2809K/2936K, paused 39ms, total 40ms
05-04 06:28:36.939 1148-1161/XXX D/dalvikvm﹕ GC_FOR_ALLOC freed 16K, 3% free 3308K/3408K, paused 24ms, total 24ms
05-04 06:28:37.219 1148-1148/XXX D/﹕ HostConnection::get() New Host Connection established 0xb769ae50, tid 1148
05-04 06:28:37.289 1148-1148/XXX W/EGL_emulation﹕ eglSurfaceAttrib not implemented
05-04 06:28:37.309 1148-1148/XXX D/OpenGLRenderer﹕ Enabling debug mode 0
I have followed this below link for playing youtube in android app. http://www.androidhive.info/2014/12/how-to-play-youtube-video-in-android-app/ Changes I have made in my app are:
I added this below line Androidmanifest.xml as said earlier: I have added below line in build.gradle:
compile files('libs/YouTubeAndroidPlayerApi.jar')
I have added this jar in libs folder.
I have already keep the code of code my xml and java file in this question. I have followed that tutorial completely.
Are you not getting any problems because of below code in xml:
<com.google.android.youtube.player.YouTubePlayerView
android:id="#+id/youtube_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp" />
And I have created config.java in java folder:
code of config.java as:
public class config {
// Google Console APIs developer key
// Replace this key with your's
public static final String DEVELOPER_KEY = "";
// YouTube video id
public static final String YOUTUBE_VIDEO_CODE = "uOpVvokKnu0"; }
As I don't have 20 reputations,I can't chat. I have one more account,it has more than 20 reputations.But i'm unable to find you there.
We are almost reached,Please help me.
Can you please enable the chat now? I have more than 20 reputations. I can chat.
And also please find the present logcat:
05-06 02:27:38.110 991-991/com.example.health.weshallovercome D/AndroidRuntime﹕ Shutting down VM
05-06 02:27:38.110 991-991/com.example.health.weshallovercome W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb3a3fba8)
05-06 02:27:38.140 991-991/com.example.health.weshallovercome E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.health.weshallovercome, PID: 991
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.health.weshallovercome/com.example.health.weshallovercome.YoutubeActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.example.health.weshallovercome.YoutubeActivity.onCreate(YoutubeActivity.java:19)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
05-06 02:27:46.480 991-991/com.example.health.weshallovercome I/Process﹕ Sending signal. PID: 991 SIG: 9
05-06 02:27:47.510 1010-1010/com.example.health.weshallovercome D/dalvikvm﹕ GC_FOR_ALLOC freed 59K, 5% free 2809K/2940K, paused 52ms, total 53ms
05-06 02:27:47.510 1010-1010/com.example.health.weshallovercome I/dalvikvm-heap﹕ Grow heap (frag case) to 3.258MB for 472516-byte allocation
05-06 02:27:47.560 1010-1019/com.example.health.weshallovercome D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 4% free 3271K/3404K, paused 39ms, total 39ms
05-06 02:27:47.960 1010-1010/com.example.health.weshallovercome D/﹕ HostConnection::get() New Host Connection established 0xb7c64710, tid 1010
05-06 02:27:48.050 1010-1010/com.example.health.weshallovercome W/EGL_emulation﹕ eglSurfaceAttrib not implemented
05-06 02:27:48.070 1010-1010/com.example.health.weshallovercome D/OpenGLRenderer﹕ Enabling debug mode 0
05-06 02:27:50.180 1010-1010/com.example.health.weshallovercome D/dalvikvm﹕ GC_FOR_ALLOC freed 24K, 3% free 3597K/3692K, paused 30ms, total 31ms
05-06 02:27:50.280 1010-1010/com.example.health.weshallovercome D/dalvikvm﹕ GC_FOR_ALLOC freed 3K, 3% free 3966K/4068K, paused 30ms, total 31ms
05-06 02:27:50.380 1010-1010/com.example.health.weshallovercome D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 3% free 4338K/4444K, paused 31ms, total 31ms
05-06 02:27:50.760 1010-1010/com.example.health.weshallovercome W/EGL_emulation﹕ eglSurfaceAttrib not implemented
05-06 02:27:54.760 1010-1010/com.example.health.weshallovercome D/dalvikvm﹕ GC_FOR_ALLOC freed 22K, 2% free 4837K/4928K, paused 34ms, total 34ms
05-06 02:27:54.970 1010-1010/com.example.health.weshallovercome I/dalvikvm﹕ Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted
05-06 02:27:54.970 1010-1010/com.example.health.weshallovercome W/dalvikvm﹕ VFY: unable to resolve virtual method 12609: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
And as you told I didn't find add as library option in right click menu. And also I added the jar file not through studio. I have opened Androidstudioprojects(which is present in C) and I have choosen my project,in that I opened libs and copied jar file. It is showing that jar file under libs in my project.I dont think that is the wrong way of adding jar,is it?
I have tested your code and i felt like fool when the issue is internet permission.
Add this to your AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET"/>
Make sure you have a valid API key since the YoutubePlayer API doc says.
If you do not set the developer key, the samples will throw a java.lang.NullPointerException and close when you attempt to run them.
EDIT:
For fixing the layout rendering issues use tools:context as
<AnyRootLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".YouTubeActivit" <!-- Your activity name here -->
>
<!-- Your child elements here -->
</AnyRootElement>
Add the jar file into the libs folder and right click on that jar file and click on "Add as library" more info on adding a jar file in android studio here
My Build.gradle (for app module):
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.mypackage.youtubedemo"
minSdkVersion 9
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile files('libs/YouTubeAndroidPlayerApi.jar')
}
Related
I've been trying to turn on an Accessibility Service using Android's. I run an emulator using Android Studio (Nexus S API 19, armabi-v7). I'm able to open the accessibility settings when the emulator is running. (By clicking on the circled submenu)
Setting Screen with Accessibility Sub-Menu highlighted
Yet when I run try to attach monkeyrunner by opening an interactive monkeyrunner terminal and running:
>> from android.com.monkeyrunner import MonkeyRunner, MonkeyDevice
>> d = MonkeyRunner.waitForConnection()
I'm unable to get navigate to the accessibility settings screen and get the error message
Result of selecting accessibility sub-menu from settings when MonkeyDevice is attached
as soon as I detach the monkeyDevice, I'm able to get to the accessibility settings screen again. Any idea what could cause it?
snippet from the logs when there's an error:
##Logs from Failure ## I/ActivityManager( 357): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.settings/.Settings} from pid 519 ... I/ActivityManager( 357): START u0 {act=android.intent.action.MAIN cmp=com.android.settings/.SubSettings (has extras)} from pid 751
...
D/SubSettings( 751): Launching fragment com.android.settings.accessibility.AccessibilitySettings ... E/AndroidRuntime( 751): FATAL EXCEPTION: main
E/AndroidRuntime( 751): Process: com.android.settings, PID: 751
E/AndroidRuntime( 751): java.lang.RuntimeException: Unable to resume activity {com.android.settings/com.android.settings.SubSettings}: java.lang.NullPointerException
E/AndroidRuntime( 751): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2774)
E/AndroidRuntime( 751): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2803)
E/AndroidRuntime( 751): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2238)
E/AndroidRuntime( 751): at android.app.ActivityThread.access$800(ActivityThread.java:135)
E/AndroidRuntime( 751): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
E/AndroidRuntime( 751): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 751): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 751): at android.app.ActivityThread.main(ActivityThread.java:5001)
E/AndroidRuntime( 751): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 751): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 751): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
E/AndroidRuntime( 751): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
E/AndroidRuntime( 751): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 751): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 751): at com.android.settings.accessibility.AccessibilitySettings.loadInstalledServices(AccessibilitySettings.java:641)
E/AndroidRuntime( 751): at com.android.settings.accessibility.AccessibilitySettings.onResume(AccessibilitySettings.java:214)
E/AndroidRuntime( 751): at android.app.Fragment.performResume(Fragment.java:1743)
E/AndroidRuntime( 751): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:924)
E/AndroidRuntime( 751): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
E/AndroidRuntime( 751): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1044)
E/AndroidRuntime( 751): at android.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:1863)
E/AndroidRuntime( 751): at android.app.Activity.performResume(Activity.java:5320)
E/AndroidRuntime( 751): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2764)
E/AndroidRuntime( 751): ... 12 more
W/ActivityManager( 357): Force finishing activity com.android.settings/.SubSettings
W/ActivityManager( 357): Force finishing activity com.android.settings/.Settings ... W/ActivityManager( 357): Activity pause timeout for ActivityRecord{b3ea9e08 u0 com.android.settings/.SubSettings t2 f}
There seems to be a NullPointer exception, but I don't know what could cause that
##Log Snippet Without Failure I/ActivityManager( 357): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.settings/.Settings} from pid 519
I/ActivityManager( 357): Start proc com.android.settings for activity com.android.settings/.Settings: pid=1095 uid=1000 gids={41000, 1028, 1015, 3002, 3001, 3003}
D/dalvikvm( 59): GC_EXPLICIT freed 40K, 5% free 2777K/2900K, paused 15ms+3ms, total 96ms
D/dalvikvm( 59): GC_EXPLICIT freed <1K, 5% free 2777K/2900K, paused 3ms+14ms, total 67ms
D/dalvikvm( 59): GC_EXPLICIT freed <1K, 5% free 2777K/2900K, paused 7ms+14ms, total 76ms
D/dalvikvm( 1095): GC_FOR_ALLOC freed 118K, 7% free 2987K/3188K, paused 35ms, total 37ms
I/dalvikvm-heap( 1095): Grow heap (frag case) to 3.602MB for 635812-byte allocation
D/dalvikvm( 1095): GC_FOR_ALLOC freed 3K, 6% free 3605K/3812K, paused 44ms, total 44ms
D/dalvikvm( 1095): GC_CONCURRENT freed <1K, 6% free 3605K/3812K, paused 4ms+2ms, total 53ms
E/BluetoothAdapter( 1095): Bluetooth binder is null
D/dalvikvm( 1095): GC_CONCURRENT freed 209K, 8% free 3793K/4088K, paused 2ms+16ms, total 65ms
D/ ( 1095): HostConnection::get() New Host Connection established 0xb82ef4c0, tid 1095
W/EGL_emulation( 1095): eglSurfaceAttrib not implemented
D/OpenGLRenderer( 1095): Enabling debug mode 0
I/ActivityManager( 357): Displayed com.android.settings/.Settings:
+2s599ms
D/dalvikvm( 1095): GC_CONCURRENT freed 124K, 5% free 4057K/4268K, paused 15ms+5ms, total 101ms
I/ActivityManager( 357): START u0 {act=android.intent.action.MAIN cmp=com.android.settings/.SubSettings (has extras)} from pid 1095
D/SubSettings( 1095): Launching fragment com.android.settings.accessibility.AccessibilitySettings
W/EGL_emulation( 1095): eglSurfaceAttrib not implemented
D/dalvikvm( 1095): GC_CONCURRENT freed 223K, 7% free 4267K/4576K, paused 20ms+65ms, total 345ms
I/Choreographer( 1095): Skipped 120 frames! The application may be doing too much work on its main thread.
I/ActivityManager( 357): Displayed com.android.settings/.SubSettings:
+3s235ms
I want to start the navigation drawer activity when pressing a button.
Here's my code:-
public void logdinScreen(View view) {
codeM = (EditText)findViewById(R.id.editText2);
if(codeM.getText().toString().equals("0000"))
{
//Toast.makeText(getBaseContext(),"LogedIn",Toast.LENGTH_LONG).show();
Intent intent2 = new Intent(OTPScreen.this,HomeScreen.class);
startActivity(intent2);
}
}
Android Manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.harpreet.btp_project" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".OTPScreen"
android:label="#string/title_activity_otpscreen" >
</activity>
<activity
android:name=".HomeScreen"
android:label="#string/title_activity_home_screen" >
</activity>
</application>
</manifest>
logcat:-
05-23 01:08:23.999 3326-3326/? D/dalvikvm﹕ Late-enabling CheckJNI
05-23 01:08:24.059 3326-3326/? E/Trace﹕ error opening trace file: No such file or directory (2)
05-23 01:08:24.059 3326-3326/? D/ActivityThread﹕ setTargetHeapUtilization:0.25
05-23 01:08:24.059 3326-3326/? D/ActivityThread﹕ setTargetHeapIdealFree:8388608
05-23 01:08:24.059 3326-3326/com.example.harpreet.btp_project D/ActivityThread﹕ setTargetHeapConcurrentStart:2097152
05-23 01:08:24.239 3326-3326/com.example.harpreet.btp_project D/dalvikvm﹕ GC_FOR_ALLOC freed 70K, 35% free 12967K/19779K, paused 21ms, total 22ms
05-23 01:08:24.259 3326-3326/com.example.harpreet.btp_project I/dalvikvm-heap﹕ Grow heap (frag case) to 29.330MB for 8294416-byte allocation
05-23 01:08:24.289 3326-3328/com.example.harpreet.btp_project D/dalvikvm﹕ GC_CONCURRENT freed 1K, 25% free 21066K/27911K, paused 12ms+1ms, total 35ms
05-23 01:08:24.429 3326-3326/com.example.harpreet.btp_project D/libEGL﹕ loaded /system/lib/egl/libEGL_adreno200.so
05-23 01:08:24.449 3326-3326/com.example.harpreet.btp_project D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_adreno200.so
05-23 01:08:24.459 3326-3326/com.example.harpreet.btp_project D/libEGL﹕ loaded /system/lib/egl/libGLESv2_adreno200.so
05-23 01:08:24.469 3326-3326/com.example.harpreet.btp_project I/Adreno200-EGL﹕ <qeglDrvAPI_eglInitialize:299>: EGL 1.4 QUALCOMM build: (Merge)
Build Date: 07/09/13 Tue
Local Branch: AU_41
Remote Branch:
Local Patches:
Reconstruct Branch:
05-23 01:08:24.529 3326-3326/com.example.harpreet.btp_project D/OpenGLRenderer﹕ Enabling debug mode 0
05-23 01:08:39.009 3326-3326/com.example.harpreet.btp_project D/AndroidRuntime﹕ Shutting down VM
05-23 01:08:39.009 3326-3326/com.example.harpreet.btp_project W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x413e2378)
05-23 01:08:39.029 3326-3326/com.example.harpreet.btp_project E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.harpreet.btp_project/com.example.harpreet.btp_project.HomeScreen}: android.view.InflateException: Binary XML file line #19: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2071)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
at android.app.ActivityThread.access$600(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4787)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #19: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:249)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106)
at com.example.harpreet.btp_project.HomeScreen.onCreate(HomeScreen.java:39)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
at android.app.ActivityThread.access$600(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4787)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.example.harpreet.btp_project.NavigationDrawerFragment.onCreateView(NavigationDrawerFragment.java:100)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1789)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:924)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1116)
at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1218)
at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2170)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:300)
at android.support.v7.app.AppCompatDelegateImplV7.callActivityOnCreateView(AppCompatDelegateImplV7.java:816)
at android.support.v7.app.AppCompatDelegateImplV11.callActivityOnCreateView(AppCompatDelegateImplV11.java:72)
at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:804)
at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:675)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:249)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106)
at com.example.harpreet.btp_project.HomeScreen.onCreate(HomeScreen.java:39)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
at android.app.ActivityThread.access$600(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4787)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
The app is working untill i press that button. When i comment the intent part and uncomment the Toast part, it is working perfect.
Am i doing it wrong?
i just added AdMob to my app. Everything seem to work well when i debug or install release version of app (HTC m7). The problem occurs on CHUWI VX2 device (esky82_tb_cn_kk, Android 4.4). It is very strange because on this device my App works in debug mode but doesn't works in release version. I try turn of pro-gourd but it doesn't help me.
Any one have idea for that?
my manifest
instruction inside my onCreate method:
mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.setAdListener(new AdListener() {
#Override
public void onAdClosed() {
super.onAdClosed();
mAdView.setVisibility(View.GONE);
}
#Override
public void onAdOpened() {
super.onAdOpened();
mAdView.startAnimation(fade_in);
mAdView.setVisibility(View.VISIBLE);
}
#Override
public void onAdFailedToLoad(int errorCode) {
super.onAdFailedToLoad(errorCode);
mAdView.setVisibility(View.GONE);
}
#Override
public void onAdLoaded() {
super.onAdLoaded();
mAdView.startAnimation(fade_in);
mAdView.setVisibility(View.VISIBLE);
}
#Override
public void onAdLeftApplication() {
super.onAdLeftApplication();
mAdView.setVisibility(View.GONE);
}
});
mAdView.loadAd(adRequest);
code inside layout.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.google.android.gms.ads.AdView android:id="#+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="#string/banner_ad_unit_id"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:visibility="gone">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
Crash log:
05-01 19:39:16.305 124-124/? I/SurfaceFlinger﹕ Skip composition for [Built-in Screen (type:0)] since dirtyRegion is empty
05-01 19:39:16.321 124-124/? I/SurfaceFlinger﹕ Skip composition for [Built-in Screen (type:0)] since dirtyRegion is empty
05-01 19:39:16.330 2162-2162/? D/AndroidRuntime﹕ Shutting down VM
05-01 19:39:16.330 2162-2162/? W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41d79c98)
05-01 19:39:16.330 2162-2162/? W/dalvikvm﹕ threadid=1: uncaught exception occurred
05-01 19:39:16.331 2162-2162/? W/System.err﹕ java.lang.RuntimeException: Unable to start activity ComponentInfo{freshfrog.pytomat/freshfrog.pytomat.Main}: java.lang.NullPointerException
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2338)
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.app.ActivityThread.access$800(ActivityThread.java:151)
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:110)
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.os.Looper.loop(Looper.java:193)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5292)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:515)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)
05-01 19:39:16.334 2162-2162/? W/System.err﹕ Caused by: java.lang.NullPointerException
05-01 19:39:16.334 2162-2162/? W/System.err﹕ at freshfrog.pytomat.Main.onCreate(Main.java:450)
05-01 19:39:16.334 2162-2162/? W/System.err﹕ at android.app.Activity.performCreate(Activity.java:5264)
05-01 19:39:16.334 2162-2162/? W/System.err﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
05-01 19:39:16.334 2162-2162/? W/System.err﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
05-01 19:39:16.335 2162-2162/? W/System.err﹕ ... 11 more
05-01 19:39:16.335 2162-2162/? W/dalvikvm﹕ threadid=1: calling UncaughtExceptionHandler
05-01 19:39:16.336 124-124/? I/SurfaceFlinger﹕ Skip composition for [Built-in Screen (type:0)] since dirtyRegion is empty
05-01 19:39:16.339 2162-2162/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: freshfrog.pytomat, PID: 2162
java.lang.RuntimeException: Unable to start activity ComponentInfo{freshfrog.pytomat/freshfrog.pytomat.Main}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2338)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at freshfrog.pytomat.Main.onCreate(Main.java:450)
at android.app.Activity.performCreate(Activity.java:5264)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
05-01 19:39:16.341 654-669/? V/Provider/Settings﹕ from settings cache , name = dropbox:data_app_crash , value = null
05-01 19:39:16.342 654-669/? D/dalvikvm﹕ create interp thread : stack size=128KB
05-01 19:39:16.342 654-669/? D/dalvikvm﹕ create new thread
05-01 19:39:16.343 654-669/? D/dalvikvm﹕ new thread created
05-01 19:39:16.343 654-669/? D/dalvikvm﹕ update thread list
05-01 19:39:16.343 916-2188/? D/dalvikvm﹕ create interp thread : stack size=128KB
05-01 19:39:16.343 916-2188/? D/dalvikvm﹕ create new thread
05-01 19:39:16.343 916-2188/? D/dalvikvm﹕ new thread created
05-01 19:39:16.343 916-2188/? D/dalvikvm﹕ update thread list
05-01 19:39:16.343 654-2191/? D/dalvikvm﹕ threadid=82: interp stack at 0x64403000
05-01 19:39:16.343 654-2191/? D/dalvikvm﹕ threadid=82: created from interp
05-01 19:39:16.343 654-669/? D/dalvikvm﹕ start new thread
05-01 19:39:16.343 654-669/? V/Provider/Settings﹕ from settings cache , name = send_action_app_error , value = 1
05-01 19:39:16.343 654-669/? W/ActivityManager﹕ Force finishing activity freshfrog.pytomat/.Main
Logcat indicate this line (Main.java:450)
mAdView.setAdListener(new AdListener() {
what is this ?
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
what were you expecting? to hit both sides?
try this
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
and let the rest go
You are getting a NullPointerException on line 450 of Main.
Look at that line. Something there has not been initialised.
I solve my problem. This issue isn't connect with AdView. It was problem with project. I made small mistakes. I don't have this line
<?xml version="1.0" encoding="utf-8"?>
on the start of xml layout file. I don't know how it can event works.
I reboot device
I added missing line to xml
I clean project (Build > Clean Project)
I rebuild project (Build > Rebuild Project)
Then my apk starts work without progourd but crash when I enable this feature. So i find this solution
I configure progourd configuration file like this.
Been struggling with andEngine and Google Game services integration for some time now. So I thought i would try my luck here.
I have done the steps described in multiple posts and blogs like this:
Issues in integrating Google Play Game Services Leaderboard in AndEngine Game
Using android studios and gradle
I have added BaseGameUtils(Android Sample), and extended the AndEngine BaseGameActivity and renamed GoogleBaseGameActivity. And then I have replaced BaseGameActivtiy with GoogleBaseGameActivity in my GameActivty(mainActivity)
The game runs before I do the extending and renaming.
MainActivity:
public class GameActivity extends GoogleBaseGameActivity
BaseGameActivity in BaseGameUtils(Google):
import org.andengine.ui.activity.BaseGameActivity;
public abstract class GoogleBaseGameActivity extends BaseGameActivity implements GameHelper.GameHelperListener
Logcat:
03-23 10:36:15.006 15860-15860/com.tdt4240.a19.mazegame I/Process﹕ Sending signal. PID: 15860 SIG: 9
03-23 10:51:33.826 17012-17012/com.tdt4240.a19.mazegame W/dalvikvm﹕ No implementation found for native Ldalvik/system/VMRuntime;.pauseGc:(Ljava/lang/String;)I
03-23 10:51:33.826 17012-17012/com.tdt4240.a19.mazegame E/ActivityThread﹕ Pause GC
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.app.ActivityThread.pauseGC(ActivityThread.java:5410)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2277)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
at android.app.ActivityThread.access$900(ActivityThread.java:169)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5487)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Native method not found: dalvik.system.VMRuntime.pauseGc:(Ljava/lang/String;)I
at dalvik.system.VMRuntime.pauseGc(Native Method)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.app.ActivityThread.pauseGC(ActivityThread.java:5410)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2277)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
at android.app.ActivityThread.access$900(ActivityThread.java:169)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5487)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
03-23 10:51:33.831 17012-17012/com.tdt4240.a19.mazegame I/PersonaManager﹕ getPersonaService() name persona_policy
03-23 10:51:33.856 17012-17012/com.tdt4240.a19.mazegame D/MultiMazed﹕ onCreateEngineOptions() called
03-23 10:51:33.881 17012-17012/com.tdt4240.a19.mazegame I/PersonaManager﹕ getPersonaService() name persona_policy
03-23 10:51:33.896 17012-17012/com.tdt4240.a19.mazegame W/PopupManager﹕ You have not specified a View to use as content view for popups. Falling back to the Activity content view which may not work properly in future versions of the API. Use setViewForPopups() to set your content view.
03-23 10:51:33.906 17012-17012/com.tdt4240.a19.mazegame I/dalvikvm﹕ Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzg
03-23 10:51:33.906 17012-17012/com.tdt4240.a19.mazegame W/dalvikvm﹕ VFY: unable to resolve virtual method 515: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
03-23 10:51:33.906 17012-17012/com.tdt4240.a19.mazegame D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000b
03-23 10:51:33.971 17012-17012/com.tdt4240.a19.mazegame D/libEGL﹕ loaded /system/lib/egl/libEGL_mali.so
03-23 10:51:33.976 17012-17012/com.tdt4240.a19.mazegame D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_mali.so
03-23 10:51:33.981 17012-17012/com.tdt4240.a19.mazegame D/libEGL﹕ loaded /system/lib/egl/libGLESv2_mali.so
03-23 10:51:33.981 17012-17012/com.tdt4240.a19.mazegame E/﹕ Device driver API match
Device driver API version: 23
User space API version: 23
03-23 10:51:33.981 17012-17012/com.tdt4240.a19.mazegame E/﹕ mali: REVISION=Linux-r3p2-01rel3 BUILD_DATE=Mon Feb 10 15:44:10 KST 2014
03-23 10:51:34.036 17012-17012/com.tdt4240.a19.mazegame D/OpenGLRenderer﹕ Enabling debug mode 0
03-23 10:51:34.141 17012-17026/com.tdt4240.a19.mazegame D/MultiMazed﹕ onPopulateScene() called
03-23 10:51:34.141 17012-17026/com.tdt4240.a19.mazegame D/MultiMazed﹕ onCreateScene() called
03-23 10:51:34.141 17012-17026/com.tdt4240.a19.mazegame D/MultiMazed﹕ onCreateResources() called
03-23 10:51:34.336 17012-17012/com.tdt4240.a19.mazegame D/AndroidRuntime﹕ Shutting down VM
03-23 10:51:34.336 17012-17012/com.tdt4240.a19.mazegame W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41d0dc08)
03-23 10:51:34.336 17012-17012/com.tdt4240.a19.mazegame E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.tdt4240.a19.mazegame, PID: 17012
java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
at com.google.android.gms.common.internal.zzk$zza.zzc(Unknown Source)
at com.google.android.gms.common.internal.zzk$zza.zzi(Unknown Source)
at com.google.android.gms.common.internal.zzk$zzc.zzjg(Unknown Source)
at com.google.android.gms.common.internal.zzk$zzb.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5487)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
03-23 10:51:34.416 17012-17026/com.tdt4240.a19.mazegame D/dalvikvm﹕ GC_EXPLICIT freed 1537K, 32% free 5498K/8056K, paused 3ms+8ms, total 74ms
03-23 10:51:34.481 17012-17026/com.tdt4240.a19.mazegame D/dalvikvm﹕ GC_EXPLICIT freed 40K, 32% free 5494K/8056K, paused 6ms+3ms, total 50ms
03-23 10:56:34.371 17012-17012/com.tdt4240.a19.mazegame I/Process﹕ Sending signal. PID: 17012 SIG: 9
This happens when the app id is incorrect or at the wrong spot. For me I had to change my manifest from:
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="000000000000" />
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version"/>
to actually referencing it in the string.xml file. So it changed to this:
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="#string/app_id" />
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version"/>
And then I put my app id in the strings class. I don't know why this was the case but that is what fixed it for me.
so I am trying to add a view to the layout on buttonclick but it throws IllegalStateException. I am adding this view to a LinearLayout inside of the LinearLayout which is shown when the activity starts.
Here is the log:
06-13 20:05:20.415 12368-12368/com.nttkjwmp.syncc.app V/Zygote﹕ Switching descriptor 9 to /dev/null
06-13 20:05:20.420 12368-12368/com.nttkjwmp.syncc.app D/dalvikvm﹕ Late-enabling CheckJNI
06-13 20:05:20.495 12368-12368/com.nttkjwmp.syncc.app D/ActivityThread﹕ handleBindApplication:com.nttkjwmp.syncc.app
06-13 20:05:20.495 12368-12368/com.nttkjwmp.syncc.app D/ActivityThread﹕ setTargetHeapUtilization:0.75
06-13 20:05:20.495 12368-12368/com.nttkjwmp.syncc.app D/ActivityThread﹕ setTargetHeapMinFree:2097152
06-13 20:05:20.925 12368-12368/com.nttkjwmp.syncc.app D/libEGL﹕ loaded /system/lib/egl/libEGL_mali.so
06-13 20:05:20.930 12368-12368/com.nttkjwmp.syncc.app D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_mali.so
06-13 20:05:20.935 12368-12368/com.nttkjwmp.syncc.app D/libEGL﹕ loaded /system/lib/egl/libGLESv2_mali.so
06-13 20:05:20.940 12368-12368/com.nttkjwmp.syncc.app E/﹕ Device driver API match
Device driver API version: 23
User space API version: 23
06-13 20:05:20.940 12368-12368/com.nttkjwmp.syncc.app E/﹕ mali: REVISION=Linux-r3p2-01rel3 BUILD_DATE=Wed Oct 9 21:05:57 KST 2013
06-13 20:05:21.005 12368-12368/com.nttkjwmp.syncc.app D/OpenGLRenderer﹕ Enabling debug mode 0
06-13 20:05:21.415 12368-12368/com.nttkjwmp.syncc.app I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy#41b6cf08 time:2108923
06-13 20:05:27.535 12368-12368/com.nttkjwmp.syncc.app I/Timeline﹕ Timeline: Activity_launch_request id:com.nttkjwmp.syncc.app time:2115041
06-13 20:05:28.185 12368-12368/com.nttkjwmp.syncc.app E/SpannableStringBuilder﹕ SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
06-13 20:05:28.185 12368-12368/com.nttkjwmp.syncc.app E/SpannableStringBuilder﹕ SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
06-13 20:05:28.185 12368-12368/com.nttkjwmp.syncc.app I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy#41dd3b68 time:2115693
06-13 20:05:30.830 12368-12368/com.nttkjwmp.syncc.app D/AndroidRuntime﹕ Shutting down VM
06-13 20:05:30.830 12368-12368/com.nttkjwmp.syncc.app W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x418b4ce0)
06-13 20:05:30.840 12368-12368/com.nttkjwmp.syncc.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.nttkjwmp.syncc.app, PID: 12368
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3830)
at android.view.View.performClick(View.java:4445)
at android.view.View$PerformClick.run(View.java:18446)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5128)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.view.View$1.onClick(View.java:3825)
at android.view.View.performClick(View.java:4445)
at android.view.View$PerformClick.run(View.java:18446)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5128)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.nttkjwmp.syncc.app.NewEventActivity.addReminder(NewEventActivity.java:104)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.view.View$1.onClick(View.java:3825)
at android.view.View.performClick(View.java:4445)
at android.view.View$PerformClick.run(View.java:18446)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5128)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)
06-13 20:05:32.365 12368-12368/com.nttkjwmp.syncc.app I/Process﹕ Sending signal. PID: 12368 SIG: 9
06-13 20:05:32.470 12740-12740/com.nttkjwmp.syncc.app D/ActivityThread﹕ handleBindApplication:com.nttkjwmp.syncc.app
06-13 20:05:32.475 12740-12740/com.nttkjwmp.syncc.app D/ActivityThread﹕ setTargetHeapUtilization:0.75
06-13 20:05:32.475 12740-12740/com.nttkjwmp.syncc.app D/ActivityThread﹕ setTargetHeapMinFree:2097152
06-13 20:05:32.700 12740-12740/com.nttkjwmp.syncc.app D/libEGL﹕ loaded /system/lib/egl/libEGL_mali.so
06-13 20:05:32.700 12740-12740/com.nttkjwmp.syncc.app D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_mali.so
06-13 20:05:32.705 12740-12740/com.nttkjwmp.syncc.app D/libEGL﹕ loaded /system/lib/egl/libGLESv2_mali.so
06-13 20:05:32.710 12740-12740/com.nttkjwmp.syncc.app E/﹕ Device driver API match
Device driver API version: 23
User space API version: 23
06-13 20:05:32.710 12740-12740/com.nttkjwmp.syncc.app E/﹕ mali: REVISION=Linux-r3p2-01rel3 BUILD_DATE=Wed Oct 9 21:05:57 KST 2013
06-13 20:05:32.775 12740-12740/com.nttkjwmp.syncc.app D/OpenGLRenderer﹕ Enabling debug mode 0
06-13 20:05:33.070 12740-12740/com.nttkjwmp.syncc.app I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy#41b72bf8 time:2120575
also here is the onClick method for the button:
public void addReminder(View view){
View reminder=(View)findViewById(R.id.reminder_layout);
reminderContainer.addView(reminder);
reminders.add(reminder);
}
reminderContainer is the LinearLayout which I want to add the view to. It is inside of another LinearLayout.
here is the reminder_layout.xml file:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/reminder_layout"
>
<Spinner
android:id="#+id/reminder_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<Spinner
android:id="#+id/reminder_type"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_action_remove"
/>
</LinearLayout>
So can anyone point out the mistake? What am I missing here?
Thanks in advance!