How to view missing buttons even after constraints have been applied? - java

I have been trying to connect to parse server and amazon web services to create a login database.
Currently, I have connected the server and the amazon web services. However, now when I add the buttons for the login details and after writing the associated code, the buttons does not show when the app is running even after I have applied constraints.
This file has been downloaded by a Udemy course that I am currently doing. The file is an old file and I had several errors that I had to fix with regards to gradle files, missing toolboxes etc.
in my Logcat, I get the following information
2019-07-20 22:33:21.627 15940-15940/? D/libEGL: Emulator has host GPU support, qemu.gles is set to 1.
2019-07-20 22:33:21.630 15940-15940/? D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
2019-07-20 22:33:21.630 15940-15940/? D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
2019-07-20 22:33:21.668 15940-15940/? D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
2019-07-20 23:23:22.364 15940-15940/? I/m.parse.starte: Not late-enabling -Xcheck:jni (already on)
2019-07-20 23:23:22.387 15940-15940/? E/m.parse.starte: Unknown bits set in runtime_flags: 0x8000
2019-07-20 23:23:22.388 15940-15940/? W/m.parse.starte: Unexpected CPU variant for X86 using defaults: x86
2019-07-20 23:23:22.516 15940-15940/com.parse.starter I/m.parse.starte: The ClassLoaderContext is a special shared library.
2019-07-20 23:23:22.799 15940-15940/com.parse.starter W/m.parse.starte: JIT profile information will not be recorded: profile file does not exits.
2019-07-20 23:23:22.800 15940-15940/com.parse.starter I/chatty: uid=10136(com.parse.starter) identical 10 lines
2019-07-20 23:23:22.800 15940-15940/com.parse.starter W/m.parse.starte: JIT profile information will not be recorded: profile file does not exits.
2019-07-20 23:23:22.836 15940-15940/com.parse.starter I/FirebaseInitProvider: FirebaseApp initialization unsuccessful
2019-07-20 23:23:22.839 15940-15940/com.parse.starter I/InstantRun: starting instant run server: is main process
2019-07-20 23:23:23.155 15940-15940/com.parse.starter W/m.parse.starte: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
2019-07-20 23:23:23.155 15940-15940/com.parse.starter W/m.parse.starte: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
2019-07-20 23:23:23.232 15940-17541/com.parse.starter D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2019-07-20 23:23:23.308 15940-17536/com.parse.starter D/OpenGLRenderer: Swap behavior 1
2019-07-20 23:23:23.309 15940-17536/com.parse.starter W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2019-07-20 23:23:23.309 15940-17536/com.parse.starter D/OpenGLRenderer: Swap behavior 0
2019-07-20 23:23:23.317 15940-17536/com.parse.starter D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0
2019-07-20 23:23:23.317 15940-17536/com.parse.starter D/EGL_emulation: eglCreateContext: 0xeb87fdc0: maj 3 min 0 rcv 3
2019-07-20 23:23:23.335 15940-17536/com.parse.starter D/EGL_emulation: eglMakeCurrent: 0xeb87fdc0: ver 3 0 (tinfo 0xe07b4540)
2019-07-20 23:23:23.391 15940-17536/com.parse.starter W/Gralloc3: mapper 3.x is not supported
2019-07-20 23:23:23.418 15940-17536/com.parse.starter D/OpenGLRenderer: Setting buffer count to 3, min_undequeued 1, extraBuffers 0
2019-07-20 23:23:23.442 15940-17536/com.parse.starter D/EGL_emulation: eglMakeCurrent: 0xeb87fdc0: ver 3 0 (tinfo 0xe07b4540)
2019-07-20 23:23:23.446 15940-17536/com.parse.starter D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 0
my sdk information in the build.gradle file is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
defaultConfig {
applicationId "com.parse.starter"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:23.0.0'
implementation 'com.parse.bolts:bolts-tasks:1.3.0'
implementation 'com.parse:parse-android:1.13.0'
implementation 'com.google.android.gms:play-services:9.4.0'
implementation 'com.android.support:multidex:1.0.0'
// androidTestImplementation 'com.android.support.test:runner:1.0.2'
//androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
and my build.gradle for the project is:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
}
}
allprojects {
repositories {
mavenCentral()
google()
}
}
ext {
compileSdkVersion = 22
buildToolsVersion = "23.0.1"
minSdkVersion = 9
targetSdkVersion = 23
}
my acitivity__main.xml code is :
<!--
~ Copyright (c) 2015-present, Parse, LLC.
~ All rights reserved.
~
~ This source code is licensed under the BSD-style license found in the
~ LICENSE file in the root directory of this source tree. An additional grant
~ of patent rights can be found in the PATENTS file in the same directory.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
tools:context=".MainActivity">
<Button
android:id="#+id/signUpButton"
android:layout_width="138dp"
android:layout_height="101dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="145dp"
android:layout_marginLeft="145dp"
android:layout_marginTop="581dp"
android:layout_marginEnd="144dp"
android:layout_marginRight="144dp"
android:layout_marginBottom="64dp"
android:text="SIGN UP"
android:visibility="visible"
tools:visibility="visible" />
<EditText
android:id="#+id/usernameEditText"
android:layout_width="302dp"
android:layout_height="99dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="36dp"
android:layout_marginLeft="36dp"
android:layout_marginTop="240dp"
android:layout_marginBottom="376dp"
android:ems="10"
android:hint="Username"
android:inputType="textPersonName"
android:visibility="visible"
tools:visibility="visible" />
<EditText
android:id="#+id/passwordEditText"
android:layout_width="match_parent"
android:layout_height="124dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="33dp"
android:layout_marginLeft="33dp"
android:layout_marginTop="354dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:layout_marginBottom="268dp"
android:ems="10"
android:hint="Password"
android:inputType="textPersonName"
android:visibility="visible"
tools:visibility="visible" />
</RelativeLayout>
so I should be able to view the buttons and Editboxes that I have created but they don't show when I run the application.
This is MainActivity.java
/*
* Copyright (c) 2015-present, Parse, LLC.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.parse.starter;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Switch;
import android.widget.Toast;
import com.parse.GetCallback;
import com.parse.LogInCallback;
import com.parse.Parse;
import com.parse.ParseAnalytics;
import com.parse.ParseAnonymousUtils;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseUser;
import com.parse.SaveCallback;
import com.parse.SignUpCallback;
public class MainActivity extends AppCompatActivity {
public void signUpClicked(View view){
EditText usernameEditText = (EditText) findViewById(R.id.usernameEditText);
EditText passwordEditText = (EditText) findViewById(R.id.passwordEditText);
if (usernameEditText.getText().toString() == "" || passwordEditText.getText().toString() == ""){
Toast.makeText(this, "A username and password are required", Toast.LENGTH_LONG).show();
} else {
ParseUser user = new ParseUser();
user.setUsername(usernameEditText.getText().toString());
user.setPassword(passwordEditText.getText().toString());
user.signUpInBackground(new SignUpCallback() {
#Override
public void done(ParseException e) {
if (e==null){
//things are good and works
Log.i("Sign up", "scucess");
}else{
Toast.makeText(MainActivity.this,e.getMessage(),Toast.LENGTH_SHORT).show();
}
}
});
}
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ParseAnalytics.trackAppOpenedInBackground(getIntent());
}
}

Related

java.lang.IllegalArgumentException: Given String is empty or null

i am making login page so i have connected this app with firebase database there is email and password in database so i am trying to
Signinwithemailandpassword but it doesn't work whenever i try to run the apps it crashes
loginpage.java
public class loginpage extends AppCompatActivity {
ActivityLoginpageBinding binding;
Button loginbtn;
TextView login;
FirebaseAuth auth;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityLoginpageBinding.inflate(getLayoutInflater());
setContentView(R.layout.activity_loginpage);
login=findViewById(R.id.login);
auth=FirebaseAuth.getInstance();
loginbtn=findViewById(R.id.loginbtn);
loginbtn.setOnClickListener(new View.OnClickListener() {
final String email=binding.email.getText().toString();
final String password=binding.pwd.getText().toString();
#Override
public void onClick(View view) {
auth.signInWithEmailAndPassword(binding.email.getText().toString(),binding.pwd.getText().toString()).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
#Override
public void onComplete(#NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
Intent intent=new Intent(loginpage.this,MainActivity.class);
startActivity(intent);
Toast.makeText(loginpage.this, "successfull", Toast.LENGTH_SHORT).show();
}
else{
Toast.makeText(loginpage.this, "failed", Toast.LENGTH_SHORT).show();
Log.d("MyTag", task.getException().getMessage());
}
}
});
}
});
login.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent=new Intent(loginpage.this,signup.class);
startActivity(intent);
}
});
}
}
loginpage.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".loginpage">
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:text="Instagram"
android:textSize="30dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="242dp"
android:layout_height="235dp"
android:layout_marginTop="32dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView14"
app:srcCompat="#drawable/instagram" />
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Welcome to social world"
android:textSize="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView3" />
<EditText
android:id="#+id/email"
android:layout_width="297dp"
android:layout_height="49dp"
android:layout_marginTop="44dp"
android:background="#drawable/inputbg"
android:ems="10"
android:hint="Email"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.491"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView16" />
<EditText
android:id="#+id/pwd"
android:layout_width="297dp"
android:layout_height="49dp"
android:layout_marginTop="16dp"
android:background="#drawable/inputbg"
android:ems="10"
android:hint="Password"
android:inputType="textPersonName"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.491"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/email"
app:layout_constraintVertical_bias="0.017" />
<Button
android:id="#+id/loginbtn"
android:layout_width="298dp"
android:layout_height="51dp"
android:layout_marginTop="36dp"
android:text="login"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.495"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/pwd" />
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Don't have a account? "
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/login"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/loginbtn"
app:layout_constraintVertical_bias="0.859" />
<TextView
android:id="#+id/login"
android:layout_width="63dp"
android:layout_height="18dp"
android:text="Sign up!"
android:textColor="#F10606"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/textView15"
app:layout_constraintTop_toBottomOf="#+id/loginbtn"
app:layout_constraintVertical_bias="0.86" />
</androidx.constraintlayout.widget.ConstraintLayout>`
Error
12/24 12:13:07: Launching 'app' on Pixel 5 API 26.
App restart successful without requiring a re-install.
$ adb shell am start -n "com.example.instagram/com.example.instagram.signup" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 28962 on device 'Pixel_5_API_26 [emulator-5554]'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/zygote: Late-enabling -Xcheck:jni
W/zygote: Unexpected CPU variant for X86 using defaults: x86
I/FirebaseApp: Device unlocked: initializing all Firebase APIs for app [DEFAULT]
W/zygote: Skipping duplicate class check due to unrecognized classloader
I/DynamiteModule: Considering local module com.google.android.gms.measurement.dynamite:86 and remote module com.google.android.gms.measurement.dynamite:15
I/DynamiteModule: Selected local version of com.google.android.gms.measurement.dynamite
D/FirebaseAuth: Notifying id token listeners about user ( xmoP2dPpYhUD9acalVCdTqBiJ7e2 ).
I/FirebaseInitProvider: FirebaseApp initialization successful
I/zygote: Background concurrent copying GC freed 5896(1215KB) AllocSpace objects, 2(40KB) LOS objects, 62% free, 910KB/2MB, paused 1.368ms total 117.164ms
V/FA: onActivityCreated
V/FA: App measurement collection enabled
V/FA: App measurement enabled for app package, google app id: com.example.instagram, 1:582042892352:android:f97df8209dee5aa33f87a5
I/FA: App measurement initialized, version: 74029
I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.example.instagram
D/FA: Debug-level message logging enabled
D/FA: Resetting session stitching token to not null
I/zygote: NativeAllocBackground concurrent copying GC freed 4528(591KB) AllocSpace objects, 7(140KB) LOS objects, 59% free, 1046KB/2MB, paused 3.590ms total 105.851ms
V/FA: Connecting to remote service
V/FA: Detected application was in foreground
V/FA: Session started, time: 37468155
I/zygote: Do partial code cache collection, code=30KB, data=30KB
V/FA: Connection attempt already in progress
I/zygote: After code cache collection, code=24KB, data=28KB
I/zygote: Increasing code cache capacity to 128KB
I/FA: Tag Manager is not found and thus will not be used
I/zygote: Do partial code cache collection, code=24KB, data=46KB
I/zygote: After code cache collection, code=24KB, data=46KB
I/zygote: Increasing code cache capacity to 256KB
I/zygote: JIT allocated 71KB for compiled code of void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int)
I/zygote: Compiler allocated 4MB to compile void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int)
D/OpenGLRenderer: HWUI GL Pipeline
V/FA: Connection attempt already in progress
I/chatty: uid=10097(u0_a97) Measurement Wor identical 1 line
V/FA: Connection attempt already in progress
V/FA: Activity resumed, time: 37468263
V/FA: Connection attempt already in progress
V/FA: Connection attempt already in progress
D/: HostConnection::get() New Host Connection established 0x9f3f98c0, tid 29000
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
D/EGL_emulation: eglCreateContext: 0x9f4d4620: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0x9f4d4620: ver 2 0 (tinfo 0x9f6ff450)
D/EGL_emulation: eglMakeCurrent: 0x9f4d4620: ver 2 0 (tinfo 0x9f6ff450)
I/Choreographer: Skipped 51 frames! The application may be doing too much work on its main thread.
D/FA: Connected to remote service
V/FA: Processing queued up service tasks: 7
W/View: dispatchProvideAutofillStructure(): not laid out, ignoring
I/AssistStructure: Flattened final assist data: 3448 bytes, containing 1 windows, 12 views
I/zygote: Do full code cache collection, code=124KB, data=61KB
I/zygote: After code cache collection, code=120KB, data=46KB
V/FA: Inactivity, disconnecting from the service
I/zygote: Do partial code cache collection, code=122KB, data=50KB
I/zygote: After code cache collection, code=122KB, data=50KB
I/zygote: Increasing code cache capacity to 512KB
V/FA: Recording user engagement, ms: 54118
V/FA: onActivityCreated
V/FA: Connecting to remote service
V/FA: Connection attempt already in progress
V/FA: Activity paused, time: 37522383
V/FA: Activity resumed, time: 37522548
V/FA: Connection attempt already in progress
V/FA: Connection attempt already in progress
D/EGL_emulation: eglMakeCurrent: 0x9f4d4620: ver 2 0 (tinfo 0x9f6ff450)
D/FA: Connected to remote service
V/FA: Processing queued up service tasks: 4
W/View: dispatchProvideAutofillStructure(): not laid out, ignoring
I/AssistStructure: Flattened final assist data: 2780 bytes, containing 1 windows, 10 views
I/zygote: Do full code cache collection, code=249KB, data=167KB
I/zygote: After code cache collection, code=249KB, data=134KB
V/FA: Inactivity, disconnecting from the service
I/zygote: Do partial code cache collection, code=249KB, data=139KB
I/zygote: After code cache collection, code=249KB, data=139KB
I/zygote: Increasing code cache capacity to 1024KB
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.instagram, PID: 28962
java.lang.IllegalArgumentException: Given String is empty or null
at com.google.android.gms.common.internal.Preconditions.checkNotEmpty(com.google.android.gms:play-services-basement##18.1.0:2)
at com.google.firebase.auth.FirebaseAuth.signInWithEmailAndPassword(com.google.firebase:firebase-auth##21.1.0:1)
at com.example.instagram.loginpage$1.onClick(loginpage.java:44)
at android.view.View.performClick(View.java:6256)
at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1219)
at android.view.View$PerformClick.run(View.java:24701)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
need to find out the mistake and why app crashes
Where have you set the values for the email and password when you are authenticating with firebase?
In your code, you are doing binding.email.getText().toString() and binding.pwd.getText().toString(). These are potentially empty as I am not seeing you set the value of those views either in your xml or in your code and hence the exception is being thrown.
Just try setting those in your xml or via code and try authentication, it should work.

Android Studio, Logcat displays infinite "I/art: Enter while loop.", even when running Empty Activity

Building an app in Android Studio. In the logcat I get an infinite display of:
"I/art: Enter while loop."
The app works like a charm but it still looks weird. On Google I couldn't find anything and here on stack I found one reference with a very specific situation and a very specific solution.
Problem is that in my case it even shows up when I just run an 'empty activity' on my phone.
Currently using: API 19: Android 4.4 (KitKat) but have also tried on higher API's.
If any other files (gradle/manifest) are needed please let me know, hope someone can tell me whats going on (or maybe this is even normal?).
Thanks.
JAVA file
package com.example.xxxxxxx.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
XML file
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.xxxxxxx.myapplication.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
Logcat
W/System: ClassLoader referenced unknown path: /data/app/com.example.xxxxxxx.myapplication-1/lib/arm
I/InstantRun: starting instant run server: is main process
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
I/art: Enter while loop.
V/PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = null, this = DecorView#a600dae[]
D/WindowClient: Add to mViews: DecorView#a600dae[MainActivity], this = android.view.WindowManagerGlobal#19554c2
D/OpenGLRenderer: Dumper init 2 threads <0xa132b480>
D/OpenGLRenderer: <com.example.xxxxxxx.myapplication> is running.
D/OpenGLRenderer: CanvasContext() 0x9fdc1800
D/GraphicBuffer: register, handle(0x9fd86870) (w:576 h:576 s:576 f:0x1 u:0x000100)
D/ViewRootImpl[MainActivity]: hardware acceleration is enabled, this = ViewRoot{c7462d3 com.example.xxxxxxx.myapplication/com.example.xxxxxxx.myapplication.MainActivity,ident = 0}
V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = ViewRoot{c7462d3 com.example.xxxxxxx.myapplication/com.example.xxxxxxx.myapplication.MainActivity,ident = 0}, this = DecorView#a600dae[MainActivity]
D/Surface: Surface::allocateBuffers(this=0x94d6d700)
D/OpenGLRenderer: CanvasContext() 0x9fdc1800 initialize window=0x94d6d700, title=com.example.xxxxxxx.myapplication/com.example.xxxxxxx.myapplication.MainActivity
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
D/OpenGLRenderer: Created EGL context (0xaa2bdb80)
D/OpenGLRenderer: ProgramCache.init: enable enhancement 1
I/OpenGLRenderer: Get disable program binary service property (0)
I/OpenGLRenderer: Initializing program atlas...
I/ProgramBinary/Service: ProgramBinaryService client side disable debugging.
I/ProgramBinary/Service: ProgramBinaryService client side disable binary content debugging.
D/ProgramBinary/Service: BpProgramBinaryService.getReady
D/ProgramBinary/Service: BpProgramBinaryService.getProgramBinaryData
I/OpenGLRenderer: Program binary detail: Binary length is 91876, program map length is 124.
I/OpenGLRenderer: Succeeded to mmap program binaries. File descriptor is 65, and path is /dev/ashmem.
I/OpenGLRenderer: No need to use file discriptor anymore, close fd(65).
D/OpenGLRenderer: Initializing program cache from 0x0, size = -1
I/[MALI][Gralloc]: dlopen libsec_mem.so fail
D/Surface: Surface::connect(this=0x94d6d700,api=1)
W/libEGL: [ANDROID_RECORDABLE] format: 1
D/Surface: Surface::setBufferCount(this=0x94d6d700,bufferCount=4)
W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
V/InputMethodManager: onWindowFocus: null softInputMode=288 first=true flags=#81810100
D/GraphicBuffer: register, handle(0x9fd86bf0) (w:480 h:800 s:480 f:0x1 u:0x000f02)
D/OpenGLRenderer: CacheTexture 3 upload: x, y, width height = 0, 0, 1024, 155
D/OpenGLRenderer: ProgramCache.generateProgram: 0
D/OpenGLRenderer: ProgramCache.generateProgram: 34359738371
D/OpenGLRenderer: ProgramCache.generateProgram: 240518168576
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
.... etc.
MANIFEST
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.xxxxxxx.myapplication">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
GRADLE
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.xxxxxxx.myapplication"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
Though I don't see evident reasons for the problem in your empty Activity, in my case it was some logics excessively repeated many times and overloading Android Runtime what made screen be held for some time and a I/art: Enter while loop. message in console logs.
The problem was solved by reducing logics to only one pass. You can also try doing it on a separate thread.
It looks like it's some kind of debugging message what was left in Android Studio or some of the dependencies your software has.
You should try to update every library, the Android Studio and it's components to latest version and that will solve the issue.

esp8266 android connection via telnet

Ive been trying from a very long time to send a string from android app to esp8266 through Telnet. I wish to see the output on serial monitor of arduino IDE.I have used the code from send string to esp8266 via android using telnet
Here are the logs that Im getting on running my android code on connecting connect and send button.
01/18 20:02:32: Launching app
Cold swapped changes.
$ adb shell am start -n "com.example.manveenkaur.optimized/com.example.manveenkaur.optimized.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 9556 on device samsung-sm_e700h-268ada67
I/InstantRun: Instant Run Runtime started. Android package is com.example.manveenkaur.optimized, real application class is null.
D/SecWifiDisplayUtil: Metadata value : none
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
D/PhoneWindow: *FMB* installDecor mIsFloating : false
D/PhoneWindow: *FMB* installDecor flags : -2139029248
D/ViewRootImpl: Buffer Count from app info with ::-1 && -1 for :: com.example.manveenkaur.optimized from View :: -1 DBQ Enabled ::false false
D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
D/PhoneWindow: *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
D/PhoneWindow: *FMB* isFloatingMenuEnabled return false
I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: (I716aebe4f9)
OpenGL ES Shader Compiler Version: E031.25.03.04
Build Date: 07/01/15 수
Local Branch: AU_LINUX_ANDROID_LA.BR.1.1.3_RB1.05.01.00.032.031_02060873_02063264
Remote Branch:
Local Patches:
Reconstruct Branch:
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Get maximum texture size. GL_MAX_TEXTURE_SIZE is 4096
D/OpenGLRenderer: Enabling debug mode 0
I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy#1e34142f time:924988396
D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
D/ViewRootImpl: Buffer Count from app info with ::-1 && -1 for :: com.example.manveenkaur.optimized from View :: -1 DBQ Enabled ::false false
D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN`
1. I am unable to resolve this ACTION_DOWN statement
2. Also Id like to know what `Buffer Count from app info with ::-1 && -1 for :: com.example.manveenkaur.optimized from View :: -1 DBQ Enabled ::false false means
3. Further on clicking disconnect it shows me the following :-
W/System.err: java.io.IOException: BufferedInputStream is closed
W/System.err: at java.io.BufferedInputStream.streamClosed(BufferedInputStream.java:125)
W/System.err: at java.io.BufferedInputStream.read(BufferedInputStream.java:257)
W/System.err: at java.io.BufferedInputStream.read(BufferedInputStream.java:290)
W/System.err: at org.apache.commons.io.input.ProxyInputStream.read(ProxyInputStream.java:98)
W/System.err: at org.apache.commons.io.input.TeeInputStream.read(TeeInputStream.java:127)
W/System.err: at java.io.InputStreamReader.read(InputStreamReader.java:231)
W/System.err: at java.io.BufferedReader.fillBuf(BufferedReader.java:145)
W/System.err: at java.io.BufferedReader.readLine(BufferedReader.java:397)
W/System.err: at com.example.manveenkaur.optimized.PioneerController$1.run(PioneerController.java:41)
W/System.err: at java.lang.Thread.run(Thread.java:818)
Also
heres activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.example.manveenkaur.optimized.MainActivity">
<EditText
android:id="#+id/EditTextMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:hint="#string/message"
android:inputType="text"></EditText>
<Button
android:id="#+id/sendButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/send_button_text"></Button>
<Button
android:id="#+id/connectButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/connect_button_text"></Button>
<Button
android:id="#+id/disconnectButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/disconnect_button_text"></Button>
</LinearLayout>
</FrameLayout>
One question upfront: Are you using SoftwareSerial or HardwareSerial to talk to the ESP8266? Using SoftwareSerial is not going to make you happy.

Constraint layout beta 4 - fragments don't work

Note 0:
At least try this code and let us know if it works for you or not. Because in theory this should work, but it doesn't
Note 1:
There is no error in this code it simply doesn't work if you are on any Constraint layout above alpha-7. However, I'm putting the logcat.
MainActivity.java:
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentManager mFragmentManager = getSupportFragmentManager();
FragmentTransaction mFragmentTransaction = mFragmentManager.beginTransaction();
Fragment fragment = new stupid();
mFragmentTransaction
.add(R.id.main_activity, fragment, "stupid")
.addToBackStack("stupid")
.commit();
}
}
activity_main.xml:
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/main_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorPrimary"
android:clickable="true"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<TextView
android:text="Hi 1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:layout_editor_absoluteY="13dp"
tools:layout_editor_absoluteX="18dp"
android:id="#+id/textView" />
</android.support.constraint.ConstraintLayout>
Stupid.java:
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {#link Fragment} subclass.
*/
public class stupid extends Fragment {
public stupid() {
// Required empty public constructor
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_stupid, container, false);
}
}
fragment_stupid.xml:
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx.stupid">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/hello_blank_fragment"
android:id="#+id/textView2"
tools:layout_constraintTop_creator="1"
tools:layout_constraintLeft_creator="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="136dp" />
</android.support.constraint.ConstraintLayout>
Log:
12-04 10:28:30.965 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/art: Late-enabling -Xcheck:jni
12-04 10:28:31.015 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/InstantRun: Instant Run Runtime started. Android package is xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx, real application class is null.
12-04 10:28:31.299 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx W/art: Failed to find OatDexFile for DexFile /data/data/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx/files/instant-run/dex/slice-slice_1-classes.dex ( canonical path /data/data/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx/files/instant-run/dex/slice-slice_1-classes.dex) with checksum 0xe09cbad0 in OatFile /data/data/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx/cache/slice-slice_1-classes.dex
12-04 10:28:31.512 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/LoadedApk: No resource references to update in package common
12-04 10:28:31.512 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/LoadedApk: No resource references to update in package com.brit.swiftdark
12-04 10:28:31.809 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx W/ResourceType: For resource 0x01030224, entry index(548) is beyond type entryCount(29)
12-04 10:28:31.809 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx W/ResourceType: For resource 0x01030224, entry index(548) is beyond type entryCount(29)
12-04 10:28:31.843 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
12-04 10:28:31.947 12609-12726/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
12-04 10:28:31.956 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx D/Atlas: Validating map...
12-04 10:28:31.996 12609-12726/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/Adreno: QUALCOMM build : 065751b,
Build Date : 04/15/15
OpenGL ES Shader Compiler Version: E031.25.03.07
Local Branch :
Remote Branch : quic/LA.BF64.1.2.1_rb2.9
Remote Branch : NONE
Reconstruct Branch : AU_LINUX_ANDROID_LA.BF64.1.2.1_RB2.05.01.00.081.016 + 065751b + NOTHING
12-04 10:28:32.003 12609-12726/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/OpenGLRenderer: Initialized EGL, version 1.4
12-04 10:28:32.011 12609-12726/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx D/OpenGLRenderer: Enabling debug mode 0
12-04 10:28:32.069 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy#22f2f04f time:200835125
Edit 1:
Alpha-7
Beta-4
Please refer to this post for an answer .... ConstraintLayout 1.0.2 shows nothing
I know this is both "This post and the linked post" are mine, also the answer. But I been looking for an answer for almost a year. I finally found that older versions of ConstraintLayout will, for some reason, be added on top of the activity. Newer versions of ConstraintLayout fragment will be put in back of the activity. or at least that's what it looks to me. That's why I'm saying make your activity transparent.

AdMob - Ad not displayed - Error 2

I am building an android application that has two versions.One with Ad. and one with out Ad. . I've successfully integrated the AdMob in the application. but the Ads are not getting displayed on the screen.
Here's my
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.myapp"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors{
free{
applicationId "com.myapp"
buildConfigField "boolean","IS_PAID_VERSION", "false"
}
paid{
applicationId "com.myapp.paid"
buildConfigField "boolean","IS_PAID_VERSION", "true"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services-ads:8.4.0'
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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_parent"
xmlns:ads="http://schemas.android.com/apk/res-auto"
tools:context="com.myapp.activities.AdTestActivity">
<com.google.android.gms.ads.AdView
android:id="#+id/ad_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="#string/ad_unit_id" />
</RelativeLayout>
AdTestActivity.java
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.myapp.R;
public class AdTestActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ad_test);
final AdView adView = (AdView) findViewById(R.id.ad_view);
final AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("A144A6A159A94CC77CE70EC1A874B93A") //My test device 1
.addTestDevice("8477FA9B6C105C84897FC2717E19A548") //My test device 2
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.build();
adView.loadAd(adRequest);
}
}
The ad is no getting displayed on the screen, and the logcat says...
I/Ads: Starting ad request.
02-12 00:24:41.381 15472-15493/com.myapp W/Ads: There was a problem getting an ad response. ErrorCode: 2
02-12 00:24:41.382 15472-15472/com.myapp I/Ads: Scheduling ad refresh 60000 milliseconds from now.
02-12 00:24:41.382 15472-15472/com.myapp W/Ads: Failed to load ad: 2
PS: I've a good internet connection and valid AdUnitId. I don't have any kind of AdBlock applications in my device. I've also read all SO threads about this problem, but none of them worked for me.
What am i doing wrong here ? :(
I had the same issue and I fixed it by updating Google Play Services to the latest version on my mobile. So maybe try updating it from Play Store.

Categories