小编Pan*_*iss的帖子

Android Studio - AAPT:错误:文件无法使用 PNG 图像进行编译

我当时在 Ubuntu linux 上工作,最近我撤回了我的项目并开始在 Win10 上工作。

从现在开始我无法构建/运行我的应用程序。资源文件夹中的那些 PNG 文件肯定有问题。

这是尝试构建应用程序时的错误输出:

Executing tasks: [:app:assembleDebug] in project C:\Users\Psz\Documents\Android-ChatRoom-Client

> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:javaPreCompileDebug UP-TO-DATE
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
> Task :app:extractDeepLinksDebug UP-TO-DATE
> Task :app:processDebugManifest UP-TO-DATE
> Task :app:mergeDebugShaders UP-TO-DATE
> Task :app:compileDebugShaders NO-SOURCE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :app:mergeDebugAssets UP-TO-DATE
> Task :app:processDebugJavaRes …
Run Code Online (Sandbox Code Playgroud)

java android gradle aapt android-studio

14
推荐指数
2
解决办法
2万
查看次数

云 Firestore 中的时间字段 serverTimestamp() 在第一个快照上返回 null

我从 Cloud Firestore 读取一些数据(消息),在文档中我有一个timestamp时间字段。\n我有一个流:

\n
Stream<QuerySnapshot> get chats {\n    return chatCollection.document(roomid).collection("messages").snapshots();\n  }\n
Run Code Online (Sandbox Code Playgroud)\n

用于在我的数据库中发生更新(例如新消息)时获取消息。

\n

因此,当我启动应用程序时,它会从数据库读取所有数据(消息)并打印出来。\n这是每次获取新快照时我的控制台和消息的样子:

\n
D/ViewRootImpl@a0e5145[MainActivity]( 3045): MSG_RESIZED: frame=Rect(0, 0 - 1440, 2560) ci=Rect(0, 96 - 0, 1164) vi=Rect(0, 96 - 0, 1164) or=1\nD/ViewRootImpl@a0e5145[MainActivity]( 3045): Relayout returned: old=[0,0][1440,2560] new=[0,0][1440,2560] result=0x1 surface={valid=true 492514541568} changed=false\nI/flutter ( 3045): DEBUG: TEST-MESSAGE what??? 2020-10-09 22:30:12.249\nI/flutter ( 3045): DEBUG: TEST-MESSAGE \xce\xbb\xce\xbf\xce\xbb 2020-10-09 21:59:58.212\nI/flutter ( 3045): DEBUG: TEST-MESSAGE gamieste 2020-10-09 22:33:10.902\nI/flutter ( 3045): DEBUG: TEST-MESSAGE holly 2020-10-09 22:26:39.672\nI/flutter ( 3045): DEBUG: TEST-MESSAGE \xce\xb3\xcf\x86 …
Run Code Online (Sandbox Code Playgroud)

timestamp firebase flutter google-cloud-firestore

8
推荐指数
1
解决办法
3200
查看次数

Flutter:TabBarView 移动到选项卡也会重建其他选项卡

我使用过TabBarView并且发现了一些非常奇怪的东西。我在所有选项卡的小部件中放置了一些打印消息,以便在滑动选项卡时获得反馈。我得到了这些结果:

  • 从 0 -> 1:调用 Tab 1、调用 Tab 3、调用 Tab 4、调用 Tab 0。
  • 从 1 -> 2:调用 Tab 2、调用 Tab 2、调用 Tab 1、调用 Tab 3、调用 Tab 4、调用 Tab 2。
  • 从 2 -> 3:调用选项卡 1、调用选项卡 3、调用选项卡 4、调用选项卡 2。
  • 从 3 -> 4:调用选项卡 1、调用选项卡 3、调用选项卡 4。

真是奇怪的事情。它实际上重建(调用setState)一个选项卡,即使它没有被选择。请记住,只有选项卡 0 和选项卡 2 内部有实际内容,其他选项卡都有空容器。

这是我的代码:

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
  final AuthService _authService = AuthService();
  final colors = …
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-layout

5
推荐指数
1
解决办法
4744
查看次数

Spring Boot REST API POST 401 未经授权

这真的很奇怪,我确信我错过了一些东西。这是我的 spring 安全配置类:

@Configuration
@EnableWebSecurity
public class AppSecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    private DataSource dataSource;

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {

        auth.jdbcAuthentication().dataSource(dataSource).passwordEncoder(passwordEncoder())
                .usersByUsernameQuery(
                        "select username,password, enabled from user where username=?")
                .authoritiesByUsernameQuery(
                        "select username, authority from authorities where username=?");

    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http    .cors()
                .and()
                .authorizeRequests() // authorize
                .antMatchers("/task/*").permitAll()
                .antMatchers(HttpMethod.POST,"/task/*").permitAll()
                .anyRequest().authenticated() // all requests are authenticated
                .and()
                .httpBasic();
    }

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }

}

Run Code Online (Sandbox Code Playgroud)

因此,在Postman上,当我发送GET …

java spring http-post spring-security spring-boot

3
推荐指数
1
解决办法
9341
查看次数