我正在尝试使用Symfony项目配置Gitlab-ci,在阅读了外部博客中的文档和一些示例后,我无法完成设置。这些是我的文件:
.gitlab-ci.yml:
public class StudentsProfile extends AppCompatActivity {
String username = "username";
TextView reg_no;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.students_profile);
reg_no =(TextView) findViewById(R.id.registration_no);
Intent inn = getIntent();
if (null != inn) {
username = inn.getStringExtra(Login.KEY_USERNAME);
//District = inn.getStringExtra(BuyApartmentsOne.KEY_DISTRICT_NAME);
}
String url ="http://192.168.43.104:82:82/COOPERP/Mobile/Default.aspx?DataFormat=StudentBioData®no="+username;
Ion.with(StudentsProfile.this)
.load(url)
.asJsonObject()
.setCallback(new FutureCallback<JsonObject>() {
@Override
public void onCompleted(Exception e, JsonObject result) {
// do stuff with the result or error
String reg = result.toString();
reg_no.setText(reg);
}
});
}
}
parameters.gitlab.yml(成为parameters.yml.dist)
0-12 15:18:28.416 15645-29090/campus.app.com.newline.campusmobapp E/ProviderInstaller: libgmscore version mismatch (0 vs. 9683)
10-12 15:19:20.717 15645-15645/campus.app.com.newline.campusmobapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: campus.app.com.newline.campusmobapp, PID: 15645
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.gson.JsonObject.toString()' on a null object reference
at campus.app.com.newline.campusmobapp.StudentsProfile$1.onCompleted(StudentsProfile.java:58)
at campus.app.com.newline.campusmobapp.StudentsProfile$1.onCompleted(StudentsProfile.java:51)
at com.koushikdutta.async.future.SimpleFuture.handleCallbackUnlocked(SimpleFuture.java:107)
at com.koushikdutta.async.future.SimpleFuture.setComplete(SimpleFuture.java:141)
at com.koushikdutta.async.future.SimpleFuture.setComplete(SimpleFuture.java:124)
at com.koushikdutta.ion.IonRequestBuilder$1.run(IonRequestBuilder.java:244)
at com.koushikdutta.async.AsyncServer$RunnableWrapper.run(AsyncServer.java:60)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:211)
at android.app.ActivityThread.main(ActivityThread.java:5389)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)
我尝试过mysql用户root,另一个用户使用'MYSQL_USER'变量。结果总是一样的:
# Select image from https://hub.docker.com/_/php/
image: php:5.6
# Select what we should cache
cache:
paths:
- vendor/
before_script:
# Install git, the php image doesn't have installed
- apt-get update -yqq
- apt-get install git -yqq
- apt-get install wget -yqq
- apt-get install zip unzip zlib1g-dev -yqq
# Install mysql driver & zip
- docker-php-ext-install pdo_mysql
- docker-php-ext-install zip
- docker-php-ext-install mbstring
# Install composer
- curl -sS https://getcomposer.org/installer | php
# Install all project dependencies
- mv app/config/parameters.gitlab.yml app/config/parameters.yml.dist
- ping -c 3 mysql
- php -v
- php composer.phar clear-cache
- php composer.phar install
- php bin/console doctrine:schema:create
services:
- mysql:latest
variables:
# Configure mysql service (https://hub.docker.com/_/mysql/)
MYSQL_DATABASE: symfony
MYSQL_ROOT_PASSWORD: password
# We test PHP5.6 (the default) with MySQL
test:mysql:
script:
- vendor/bin/phpunit --configuration phpunit.xml --coverage-text
我做错了什么或错过了什么?
答案 0 :(得分:2)
问题出现在开发环境中,正如临终关怀在Gitlab forum告诉我的那样。我在开发环境中使用了一个parameters_dev.yml文件,而作曲家安装正在读取该文件,而不是我想到的参数。在parameters_dev.yml中更改数据库设置可以解决错误,现在Gitlab正在连接并执行测试。