android-studio

Android Studio app works in emulator but not on a real device

梦想与她 提交于 2020-02-04 02:48:06
问题 I am new to android programming and have been having a lot of trouble with it. I finally got my app to work in the emulator on both API 23 and 16 my target is API 16. It runs with no problems on the emulators but when I try to use it on my phone (Google Nexus 5 API 23) <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match

Final variable from resources file

為{幸葍}努か 提交于 2020-02-03 09:57:55
问题 I have an activity with some final variables. I extracted their values (let's assume they're all Strings) into a resources file. The problem: If I directly assign them on the instantiation (as following): private final String PREFERENCE_NAME = getResources().getString(R.string.preference_name); I get the following error: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference

Final variable from resources file

烂漫一生 提交于 2020-02-03 09:55:06
问题 I have an activity with some final variables. I extracted their values (let's assume they're all Strings) into a resources file. The problem: If I directly assign them on the instantiation (as following): private final String PREFERENCE_NAME = getResources().getString(R.string.preference_name); I get the following error: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference

Badge on App icon

荒凉一梦 提交于 2020-02-03 08:56:41
问题 I need to show badge on App icon in my application what i have tried: This https://github.com/leolin310148/ShortcutBadger library do it on many devices.I have checked its manifest and saw that there exists a permission for each type of launcher <!--for Samsung--> <uses-permission android:name="com.sec.android.provider.badge.permission.READ"/> <uses-permission android:name="com.sec.android.provider.badge.permission.WRITE"/> <!--for htc--> <uses-permission android:name="com.htc.launcher

Badge on App icon

[亡魂溺海] 提交于 2020-02-03 08:52:47
问题 I need to show badge on App icon in my application what i have tried: This https://github.com/leolin310148/ShortcutBadger library do it on many devices.I have checked its manifest and saw that there exists a permission for each type of launcher <!--for Samsung--> <uses-permission android:name="com.sec.android.provider.badge.permission.READ"/> <uses-permission android:name="com.sec.android.provider.badge.permission.WRITE"/> <!--for htc--> <uses-permission android:name="com.htc.launcher

Badge on App icon

♀尐吖头ヾ 提交于 2020-02-03 08:52:19
问题 I need to show badge on App icon in my application what i have tried: This https://github.com/leolin310148/ShortcutBadger library do it on many devices.I have checked its manifest and saw that there exists a permission for each type of launcher <!--for Samsung--> <uses-permission android:name="com.sec.android.provider.badge.permission.READ"/> <uses-permission android:name="com.sec.android.provider.badge.permission.WRITE"/> <!--for htc--> <uses-permission android:name="com.htc.launcher

Badge on App icon

纵然是瞬间 提交于 2020-02-03 08:52:08
问题 I need to show badge on App icon in my application what i have tried: This https://github.com/leolin310148/ShortcutBadger library do it on many devices.I have checked its manifest and saw that there exists a permission for each type of launcher <!--for Samsung--> <uses-permission android:name="com.sec.android.provider.badge.permission.READ"/> <uses-permission android:name="com.sec.android.provider.badge.permission.WRITE"/> <!--for htc--> <uses-permission android:name="com.htc.launcher

In Android Studio 2.1.3 is experimental gradle not working?

北城以北 提交于 2020-02-03 08:24:46
问题 I have a project where I mix and match regular Android Gradle Plugin: apply plugin: 'com.android.library' and Experimental Gradle Plugin as a library: apply plugin: 'com.android.model.library' In my overall build.gradle I have the following dependencies: buildscript { repositories { jcenter() } dependencies { classpath 'com.google.gms:google-services:3.0.0' classpath 'com.android.tools.build:gradle-experimental:0.7.2' classpath 'com.android.tools.build:gradle:2.1.3' } } And now after upgrade

Android Studio Mojave not starting

為{幸葍}努か 提交于 2020-02-03 05:30:05
问题 I know that this is unlikely the correct place to ask, but I don't know where I should. So I have a normal macbook from 2016. I had Android studio installed a couple of months and worked with it just fine for a long time. Now upgrading to Mojave, Android Studio doesn't open anymore. I reinstalled it already 5 times, tried everything I found in the internet but still not able to start it. After installing and moving it to applications It asks me to open it, I accept and then it starts to

SignalR in Android Studio

二次信任 提交于 2020-02-03 01:54:10
问题 I'm trying to make use of SignalR in Android Studio and while it apparently has added the projects and dependencies to my application project I'm getting constant Error:(11, 39) error: package microsoft.aspnet.signalr.client does not exist The import for these packages was dynamically added by Android studio as I started typing code to make use of it Platform.loadPlatformComponent(new AndroidPlatformComponent()); So there is something there. However when I try and actually build my main