晚安,
我是编程新手,并试图让项目在android studio中运行,但它一直失败,设计模式不起作用,因为它没有成功构建。任何提示将非常感谢。这是我在mainactivity.java文件中的内容。
我已经有其他程序可以在android studio中正常运行,但似乎无法使这个程序正常工作。
package com.example.jenna.needtograduate;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.os.Handler;
import android.os.Looper;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.constraint.ConstraintLayout;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import java.util.Timer;
import java.util.TimerTask;
import java.net.Socket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
public class MainActivity extends AppCompatActivity implements MainTimerDelegate {
private MainTimer timer;
private RelativeLayout myLayout;
private RelativeLayout authorizationContainerLayout;
private RelativeLayout authorizationLayout;
private RelativeLayout connectivityContainerLayout;
private RelativeLayout connectivityLayout;
private ProgressBar connectivityProgressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myLayout = (RelativeLayout) findViewById(R.id.myLayout);
authorizationContainerLayout = (RelativeLayout) findViewById(R.id.authorizationContainerLayout);
authorizationLayout = (RelativeLayout) findViewById(R.id.authorizationLayout);
connectivityContainerLayout = (RelativeLayout) findViewById(R.id.connectivityContainerLayout);
connectivityLayout = (RelativeLayout) findViewById(R.id.connectivityLayout);
connectivityProgressBar = (ProgressBar) findViewById(R.id.connectivityProgressBar);
timer = new MainTimer(this);
}
//region: Obstacle delegate methods
public void MainTimerDidDetectReachability(MainTimer timer, Boolean reachable) {
if (reachable) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
// perform if connection is available
connectivityLayout.animate()
.setDuration(250)
.alpha(0.0f)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
// optional completion block
connectivityContainerLayout.animate()
.setDuration(250)
.translationY(connectivityLayout.getHeight())
.alpha(0.0f)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
// optional completion block
connectivityProgressBar.setVisibility(View.INVISIBLE);
}
});
}
});
}
});
} else {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
// perform if connection is NOT available
connectivityProgressBar.setVisibility(View.VISIBLE);
connectivityContainerLayout.animate()
.setDuration(250)
.translationY(0)
.alpha(1.0f)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
// optional completion block
connectivityLayout.animate()
.setDuration(250)
.alpha(1.0f)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
// optional completion block
}
});
}
});
}
});
}
}
}
这是我收到的错误消息:
Error:error: resource color/fadedBlack (aka com.example.jenna.needforgraduation:color/fadedBlack) not found.
Error:resource color/fadedBlack (aka com.example.jenna.needforgraduation:color/fadedBlack) not found.
Error:failed linking file resources.
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
Information:BUILD FAILED in 9s
Information:7 errors
答案 0 :(得分:2)
您的项目似乎存在fadedBlack
。尝试检查colors.xml
文件夹下的values
。